Saturday, March 24, 2007

Default button in ASP.NET

           I was creating a search page and I require that when user press enter key, by default search button's click event should be fire. I look around for the solution and find the easiest one. You just need to write below line in page load of  your code behind file.

Form.DefaultButton = btnSubmit.UniqueID;

           Here btnSubmit is the name of button.

Happy Programming!!!!


Anonymous said...

I use this line as U say but not working

somthing can do befor put this line

Vinit said...

This is not working in the Mozilla Firefox...