set focus bug problem

  • Thread starter Thread starter Jason Huang
  • Start date Start date
J

Jason Huang

Hi,

private void SetFocus(Control ctrl) // SetFocus to a particular control
{
string focusScript = "<script language='javascript' id='FocusScript'> "
+
"document.getElementById('" + ctrl.ClientID +
"').focus();</script>";
Page.RegisterStartupScript("FocusScript", focusScript);
}

And in my ASP.Net C# Account.aspx.cs file in the page_load, I have
this.SetFocus(TextAccount).
But the focus just NOT set on the TextAccount control. The TextAccount is
an web form control.
Would someone tell me what's wrong?
Thanks!

Jason
 
Back
Top