Saturday, March 24, 2012

Set Focus inside of user control

Hi Everybody.

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

Thanks in advance

LeonWe 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:

"Leon" wrote:

> Hi Everybody.
> Can someone prompt me how to set Focus on any control inside of a user
> control?
> Thanks in advance
> Leon

0 comments:

Post a Comment