Hi, id like to set focus for a text box in my web form but I dont know how. the text boxes do not have a setFocus or a Focus method
Thanks!!
myTextBox.select(); <<<< JavaScriptwe use the following function which injects client side script
PublicSharedSub Set_Focus(ByVal aspPageAs System.Web.UI.Page,ByVal strControlNameAsString)
Try
Dim strScriptAsString
strScript ="<script language=javascript> document.all.item(""" & strControlName &""").focus() </script>"
aspPage.RegisterStartupScript("focus", strScript)
Catch exAs Exception
Throw ex
EndTry
EndSub
In .NET 2.0, the Focus() method will set focus if you want to do it from code-beside.
HTH,
Ryan
0 comments:
Post a Comment