Pages

Monday, December 26, 2011

Control focus with Postback

While working with ASP.Net update panel control, the Tab focus will make some problems. Here is a simple solution for that, you can use the Script Manager class to set focus to a specific control.
1
ScriptManager1.SetFocus(Control);   //You can either use the control or the clientID of the control.
And if you are using Master Pages and placing the script manager in the master page, you can use the following code to get the script manager class.
1
ScriptManager ScriptManager1 = ScriptManager.GetCurrent(this.Page)  //Getting the script manager class of the current page.

No comments: