0

ASP.NET - Handling Form Submit on Enter Key Pressed

Source : http://weblog.kevinattard.com/2011/08/aspnet-disable-submit-form-on-enter-key.html

Actually I'm new to ASP.NET. This is my first attempt to develop a system that uses ASP.NET. It is not very difficult but there are some annoying things that need to be addressed. One of them is when the enter key is pressed, the form will be submitted, but logic is not triggered as it should be.

The steps are as follows:

1. In my case, I wrapped all the form content into an updatepanel.
2. Set the DefaultButton attribute of updatepanel to a button (it can be visible one, depends on your appplication)
3. Handle the logic.

Done. Tada.....

 
Copyright © peyotest