Prevent User to Press Enter in TextBox
Hi
try this example to prevent form to Submit when user Press Enter in TextBox Control
Just add this code to your Page_Init method of the page where you want this behavior:
protected void Page_Init(object sender, EventArgs e) { TextBox1.Attributes.Add(“onkeydown”,“if(event.which || event.keyCode){if (event.keyCode == 13) return false;}”); }
Good Luck
Categories: ASP.Net, Javascript
Prevent Enter
Comments (0)
Trackbacks (0)
Leave a comment
Trackback
Recent Comments