Monday, March 26, 2012

Set Focus

Does anyone have any idea how to set focus on any control inside of a user
control?

Any help appreciated.

LeonLeon wrote:
> Does anyone have any idea how to set focus on any control inside of a user
> control?

Leon, you can use Andy Smith's FirstFocus control
[http://metabuilders.com/Tools/FirstFocus.aspx], or read up on how to do
it yourself, through server-side code, in my article:

Working with Client-Side Script
http://tinyurl.com/3w474

Essentially you need to get the ID from the control you want to set
focus to using the control's ClientID property, and then a small bit of
client-side JavaScript is needed to put focus on that control.

Happy Programming!

--

Scott Mitchell
mitchell@.4guysfromrolla.com
http://www.4GuysFromRolla.com

* When you think ASP.NET, think 4GuysFromRolla.com!

0 comments:

Post a Comment