ASP.NET 2.0 SetFocus to control

Back in ASP.NET 1.1, you have to use javascript to set focus on a particular control in the page (correct me if I am wrong). But in ASP.NET 2.0, things are so much easier.

 

Just code this:

 

Page.SetFocus(btnProjectSave);

 

The SetFocus method accepts 1 parameter which is the Control (dropdownlist, button, textboxt, etc)

 

Enjoy

Published Friday, December 29, 2006 11:55 AM by chuawenching