"when the enter key is pressed"... do you mean when you have the cursor in the textbox? This should be the default behavior of the page. If there are other controls that you want to have the Enter key cause the opstback, you can do this in page load, if the page is not a postback:
serverControl.Attributes.A
This assumes the id string in your <form runat="server" id="Form1"> is "Form1". If it is different, refer to it in the javascript command as:
document.yourformname.subm
This is IE compliant code. If you need to support other browsers we'll have to get a bit more involved (only a little, though) in the JavaScript.
John
Main Topics
Browse All Topics





by: tusharashahPosted on 2004-10-25 at 16:04:34ID: 12405972
Use Client-script to overcome this problem(trap enter key code):
e == 13){document.getElementByI d('btnSubm it').click ();}"> >
<body onkeydown="if(event.keyCod
...
<asp:Button id="btnSubmit" runat="server" Text="Submit"></asp:Button
-tushar