asp.net 2.0在使用了mater page的情况下Form defaultbutton无法设置的问题
Posted on 2006-02-16 10:39 1werwerfer 阅读(1214) 评论(3) 编辑 收藏 举报问题如题
我尝试了下列方法,在页面程序中加入:
1 protected override void OnInit(EventArgs e)
2 {
3 base.OnInit(e);
4 Page.Form.DefaultButton = "btnSearch";
5 }
2 {
3 base.OnInit(e);
4 Page.Form.DefaultButton = "btnSearch";
5 }
但是页面提示错误,宣告失败
The DefaultButton of 'form1' must be the ID of a control of type IButtonControl.
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.
Exception Details: System.InvalidOperationException: The DefaultButton of 'form1' must be the ID of a control of type IButtonControl.
Source Error:
An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below. |
Stack Trace:
不知道有没有哪位高人有好的解决方案?