I need to focus on a textbox after an item has been selected from a dropdownlist.
I’ve tried control.focus() and setfocus().
The last thing I’ve tried was Set_Focus(dtbEffectiveDate.ClientID) inside the SelectedIndexChanged method with the folowing method.
Protected Sub Set_Focus(ByVal ControlName As String)
Dim strScript As String
strScript = "<script language=javascript> window.setTimeout(""" + ControlName + ".focus();"",0); </script>"
RegisterStartupScript("focus", strScript)
End Sub
I’m out of answers so any help would be awesome.
You should select the control in javascript with document.getElementById(id):
something like:
Edit: I’m not entirely sure of the correct VB-syntax for escaping the quotes around ControlName.