Javascript
function clickButton(e, buttonid){
var evt = e ? e : window.event;
var bt = document.getElementById(buttonid);
if (bt){
if (evt.keyCode == 13){
bt.click();
return false;
}
}
}
The code behind generates the following code:
< asp:Button id="Button1" Text="Submit" OnClick="SubmitBtn_Click" runat="server" onkeypress="return clickButton(event,'Button1')"/ >
This causes web control Button1 to be clicked when the enter key is hit inside TextBox1.
No comments:
Post a Comment
Comments Welcome