<html xmlns="http://www.w3.org/1999/xhtml"> <head id="Head1" runat="server"> <title>Untitled Page</title> <script language="Javascript"> function CheckKey() { switch (event.keyCode) { case 13: Login(); break; default: //nothing } } function Login(){ document.getElementById("btnLogin").click(); } </script> </head> <body > <form id="form1" runat="server"> <div> <asp:TextBox ID="TextBox1" runat="server"></asp:TextBox> </div> <asp:Button ID="btnLogin" runat="server" Text="Login" /> </form> <script> document.body.onkeydown=CheckKey(); </script> </body> </html>
Panel
DefaultButton
<asp:Panel runat="server" ID="pnlLogin" DefaultButton="btnLogin"> Put your login textboxes and buttons here. </asp:Panel>
<asp:panel id="p" runat="server" defaultbutton="myButton" xmlns:asp="#unknown"> <%-- Text boxes here --%> <asp:button id="myButton" runat="server" /> </asp:panel>
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)