Tuesday, August 12, 2008

Enter Key Event in ASP.NET 2.0(Default Button)

ASP.NET 2.0 introduces a concept of a "default button".Defaultbutton attribute can be used with <form> or <asp:panel> controls. Which button will be "clicked" depends of where actually cursor is and which button is chosen as a default button for a form or a panel.

<form id="form1" defaultbutton="Button1" runat="server">

<asp:panel defaultbutton="button2" runat="server">
<asp:textbox id="textbox3" runat="server">
<asp:button id="button2" runat="server">
</asp:panel>

</form>