TextBox Focus
-
How do I set focus after a button is clicked to go directly into a textbox. Or even if its on load have the cursor right on the textbox automaticall Thanks
-
How do I set focus after a button is clicked to go directly into a textbox. Or even if its on load have the cursor right on the textbox automaticall Thanks
-
How do I set focus after a button is clicked to go directly into a textbox. Or even if its on load have the cursor right on the textbox automaticall Thanks
Create a module level function:
Module Module1 Public Function SetFocus(ByVal FocusControl As Control) As String 'Setting focus to supplied control Dim Script As New System.Text.StringBuilder Dim ClientID As String = FocusControl.ClientID 'Building java script With Script .Append("") .Append("document.getElementById('") .Append(ClientID) .Append("').focus();") .Append("") End With Return Script.ToString() End Function End Module
call the function above in button click eventPrivate Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click 'set focus RegisterStartupScript("setFocus", Module1.SetFocus(TextBox1)) End Sub
=postmaster http://www.programmingknowledge.com/[^] -
How do I set focus after a button is clicked to go directly into a textbox. Or even if its on load have the cursor right on the textbox automaticall Thanks
In the Page_Load Event, Type in:- Page.RegisterStartupScript("ss", "document.getElementById('" & TextBox1.ClientID & "').focus();") :) Thanks & regards, Suresh Dayma