Enter key pressed on TextBox flushes content….

ASP.Net 2.0

Enter key pressed on TextBox flushes content….

If you go on professionally developed websites, many times you need to fill in some forms.

If you notice carefully, when you filled up all the fields in the form and you want to submit the form you don't need to tab to Submit button. If your cursor is on a text box and you press enter, your form will be submitted. Try this with your form developed in .Net. Probably it will behave in very wearer ways. Your contents may get flushed or something else situation may happen at run time.

On .net platform previous to ASP.NET 2.0 solving this situation was some time taking task like using Javascript, register your control for a particular function call and do the required things in that function. OR add a text box invisible. But these all techniques may create some other problems while solving one problem.

Solution:-

ASP.NET 2.0 removes all these headaches and provides you a simple way to go.
Suppose you have 2 text box and Submit button on your form. Just put them all either inside a Form or Panel and set DefaultButton property to name of Button which you want to click.

Eg.




Comments

  1. Hello. This post is likeable, and your blog is very interesting, congratulations :-). I will add in my blogroll =). If possible gives a last there on my blog, it is about the Teclado e Mouse, I hope you enjoy. The address is http://mouse-e-teclado.blogspot.com. A hug.

    ReplyDelete

Post a Comment

Popular posts from this blog

Weekend Gateway Trip - Shrivardhan

Cross Apply Incorrect syntax near '.'

Apply CSS Class based on Browser