使用服务器端控制按钮处理

时间:2010-09-02 13:30:35

标签: asp.net

大家好我想知道,如果在我的login.aspx页面中有两个按钮logincancel

现在我按下我键盘的输入键默认选择取消按钮但是我想在登录时设置它我将如何操作?

2 个答案:

答案 0 :(得分:0)

<asp:Panel>控件具有DefaultButton属性,您可以为其指定默认按钮控件的ID。

考虑在面板中包装您的内容,并将面板的DefaultButton属性指定为login

答案 1 :(得分:0)

您可以设置表单的defaultbutton属性:

<asp:Form runat="server" id="form1" defaultbutton="idofloginbutton">
...
</asp:Form>