To enable the enter key on a textbox, to get the functionality of clicking a button, write the javascript. If you have only one button, and by setting the AutoSubmitBehavior to True, you can achieve this, but when you have multiple buttons, when the user press the Enter key, the first focused button is clicked.
With javascript the enter key code can be trapped. The following code will fire the enter key event, on the body.
<body onkeydown="if(event.keyCode == 13){document.getElementById('btnSubmit').click();}">
...
<asp:Button id="btnSubmit" runat="server" Text="Submit"></asp:Button>
If you want to trap the enter key on a textbox use the following
<head>
<script language="javascript">
function doEnterKey()
{
if ((event.which && event.which == 13) || (event.keyCode && event.keyCode == 13))
{
document.form1.submit();
}
}
</script>
</head>
<body>
<form id="form1" runat="server">
<asp:TextBox id="Text1" runate="server" />
</form>
</body>
</html>
in Page_Load procedure in code-behind file write the following code
submit1.Attributes.Add("onfocus","javascript:doEnterKey();")
Text1.Attributes.Add("onchange","javascript:doEnterKey();")
E Screw