您的位置:首页 > 编程语言 > ASP

asp.net 2.0在使用了mater page的情况下Form defaultbutton无法设置的问题

2006-02-16 10:39 836 查看
问题如题

我尝试了下列方法,在页面程序中加入:

1 protected override void OnInit(EventArgs e)
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:

不知道有没有哪位高人有好的解决方案?
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: