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:
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top