技术,思考的艺术

ASP.net ,C#,VB.NET,SQL + B2B,SCM,CRM,ERP
  博客园  :: 首页  :: 新随笔  :: 联系 :: 订阅 订阅  :: 管理

问题如题

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

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:

不知道有没有哪位高人有好的解决方案?