I have an web form that validates all the controls placed on the form.
& want to set focus to the control that is not satisfying the validation.
I tried the below code but it is not setting the focus to the control.
Code:
public void SetFocus(Control text)
{
if(text.Page.IsStartupScriptRegistered("setFocus"))
{
return;
}
System.Text.StringBuilder sb = new System.Text.StringBuilder("");
text.Page.RegisterStartupScript("setFocus",sb.ToString());
}
Any Idea ?
Thanx in advance
Vivek Shah