Set Focus inside of user control

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Hi Everybody.

Can someone prompt me how to set Focus on any control inside of a user
control?

Thanks in advance

Leon
 
We use this:
Public Shared Sub Set_Focus(ByVal strControlName As String)


Dim strScript As String
strScript = "<script language=javascript>
document.all.item(""" & strControlName & """).focus() </script>"
RegisterStartupScript("focus", strScript)

Then on the page which has the user control:
Set_Focus("uscLogin_txtUsername")

Set_Focus("uscUserControlName_ctlControlName")

For example, if the user control is call uscLoging and you have a textbox
txtUsername:
 
Back
Top