Dec 11, 2006 #1 Linda224 Programmer Joined Dec 6, 2006 Messages 80 Location US Hello I am working on a vb.net web form where after hiting submit I want the curser to set focus in a text box. Does any one know how to do that? Thank you!
Hello I am working on a vb.net web form where after hiting submit I want the curser to set focus in a text box. Does any one know how to do that? Thank you!
Dec 11, 2006 #2 ca8msm Programmer Joined May 9, 2002 Messages 11,327 Location GB Yes, you'll have to use the javascript "focus" method. ____________________________________________________________ Need help finding an answer? Try the Search Facility or read FAQ222-2244 on how to get better results. Upvote 0 Downvote
Yes, you'll have to use the javascript "focus" method. ____________________________________________________________ Need help finding an answer? Try the Search Facility or read FAQ222-2244 on how to get better results.
Dec 11, 2006 #3 jbenson001 Programmer Joined Jan 7, 2004 Messages 8,172 Location US If you are Using VS2005, the 2.0 framework as a .focus method on the textbox control. Upvote 0 Downvote
Dec 11, 2006 #4 dvannoy MIS Joined May 4, 2001 Messages 2,765 Location US if your using VS2003 you can do something like this Private Sub SetFocus(ByVal ctrl As System.Web.UI.Control) Dim s As String = "<SCRIPT language='javascript'>document.getElementById('" & ctrl.ID & "').focus() </SCRIPT>" RegisterStartupScript("focus", s) End Sub Then use SetFocus(TextBox) there are a few different ways to do this. try searching the forum as well. Upvote 0 Downvote
if your using VS2003 you can do something like this Private Sub SetFocus(ByVal ctrl As System.Web.UI.Control) Dim s As String = "<SCRIPT language='javascript'>document.getElementById('" & ctrl.ID & "').focus() </SCRIPT>" RegisterStartupScript("focus", s) End Sub Then use SetFocus(TextBox) there are a few different ways to do this. try searching the forum as well.
Dec 12, 2006 Thread starter #5 Linda224 Programmer Joined Dec 6, 2006 Messages 80 Location US Thank you guys for your help The Javascript worked perfect! -Linda Upvote 0 Downvote