How to Control button event in Web Forms when user press Enter button
Suppose you have more then one button (three button named: btnFirstButton,btnSecondButton,btnThirdButton) in your web page and after enter button press
First button called.
In textbox onkeypress client side (onkeypress="return OnLevelBlur(event);).
<asp:textbox id="txtbox1" Runat="server" MaxLength="10" onkeypress="return OnLevelBlur(event);">
char = String.fromCharCode(e.keyCode);
if (xCode == 13)
document.all["btnFirstButton"].disabled="false"; document.all["btnSecondButton"].disabled="false"; document.Form1.txtbox1.focus();
How its Work
Basically you catch Enter button events and put the condition that if enter button pressed then disable btnFirstButton and btnSecondButton then automatically btnThirdButton click event will fire and after server trip that two buttons btnFirstButton and btnSecondButton will active again.
You are disabling some button which you dont want to click after enter button.
Yahoo! for Good
Click here to donate to the Hurricane Katrina relief effort.