Textbox Set Focus on Load while using AJAX Controls on Page
Whenever you are using AJAX Controls on Page, always remember that
normal way of making set Focus to textbox controls won't work.
Solution to this Problem:
protected void Page_Load(object sender, EventArgs e)
{
AjaxControlToolkit.Utility.SetFocusOnLoad(txtEmailId);
}
Where, txtEmailId is control name.
In every other case where you are not using AJAX Control on Page load and your
.Net Application is in VS.Net 2005 or above version, you can try using following
protected void Page_Load(object sender, EventArgs e)
{
this.Form.DefaultFocus = this.txtEmailId.ClientID;
}
Note: There are various techniques i have discuss most commonly used
technique to set focus for textbox control.
normal way of making set Focus to textbox controls won't work.
Solution to this Problem:
protected void Page_Load(object sender, EventArgs e)
{
AjaxControlToolkit.Utility.SetFocusOnLoad(txtEmailId);
}
Where, txtEmailId is control name.
In every other case where you are not using AJAX Control on Page load and your
.Net Application is in VS.Net 2005 or above version, you can try using following
protected void Page_Load(object sender, EventArgs e)
{
this.Form.DefaultFocus = this.txtEmailId.ClientID;
}
Note: There are various techniques i have discuss most commonly used
technique to set focus for textbox control.
2 comments:
Nice one - did the trick.
simple and effective. thanks!
Post a Comment