J
JC
Hello-
I have a form which has a listbox, a textbox and a submit button. The
user types a phone number into the textbox, clicks button, text gets
added to the listbox. After this process I need the focus to be back
in the textbox. Sounds easy hu?
Here's my code-
Private Sub cmdAddLine_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles cmdAddLine.Click
lstLines.Items.Add(PhoneFormat(txtAddLine.Text))
txtAddLine.Text = ""
setFocus(txtAddLine)
End Sub
Public Sub setFocus(ByVal ctrl As System.Web.UI.Control)
Dim strS As String
strS = "<SCRIPT language='javascript'>document.getElementById('" +
ctrl.ID + "').focus();</SCRIPT>"
RegisterStartupScript("focus", strS)
End Sub
This will not place the focus in the textbox. What am I missing?
Again, PLEASE help. Thanks much!
I have a form which has a listbox, a textbox and a submit button. The
user types a phone number into the textbox, clicks button, text gets
added to the listbox. After this process I need the focus to be back
in the textbox. Sounds easy hu?
Here's my code-
Private Sub cmdAddLine_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles cmdAddLine.Click
lstLines.Items.Add(PhoneFormat(txtAddLine.Text))
txtAddLine.Text = ""
setFocus(txtAddLine)
End Sub
Public Sub setFocus(ByVal ctrl As System.Web.UI.Control)
Dim strS As String
strS = "<SCRIPT language='javascript'>document.getElementById('" +
ctrl.ID + "').focus();</SCRIPT>"
RegisterStartupScript("focus", strS)
End Sub
This will not place the focus in the textbox. What am I missing?
Again, PLEASE help. Thanks much!