C# 在webfrom上按enter键会引发错误

C# 在webfrom上按enter键会引发错误,c#,asp.net,button,webforms,C#,Asp.net,Button,Webforms,我在asp.net中使用了一个表单,我有很多按钮,我希望当我按enter键时,默认情况下会触发SAVE按钮,但当我在此页面上按enter键时,它会抛出错误: The resource cannot be found. Description: HTTP 404. The resource you are looking for (or one of its dependencies) could have been removed, had its name changed, or is te

我在asp.net中使用了一个表单,我有很多按钮,我希望当我按enter键时,默认情况下会触发SAVE按钮,但当我在此页面上按enter键时,它会抛出错误:

 The resource cannot be found.
Description: HTTP 404. The resource you are looking for (or one of its dependencies) could have been removed, had its name changed, or is temporarily unavailable.  Please review the following URL and make sure that it is spelled correctly.

代码:

更新:这一行应该工作肯定,但不确定在哪里把它放在我的网页

this.Page.Form.DefaultButton = btnSave.UniqueID;
将面板控件的属性设置为按钮id

<asp:Panel DefaultButton="btnSave" ... > ... </asp:Panel>
。。。

您是否有可以监听“回车”键的javascript?
this.Page.Form.DefaultButton = btnSave.UniqueID;
<asp:Panel DefaultButton="btnSave" ... > ... </asp:Panel>