Set Focus inside of user control

G

Guest

Hi Everybody.

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

Thanks in advance

Leon
 
G

Guest

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

Members online

Forum statistics

Threads
473,770
Messages
2,569,583
Members
45,075
Latest member
MakersCBDBloodSupport

Latest Threads

Top