Hi,
In the page I’m developing, I have two textboxes, and two CheckBoxLists. Each CheckBoxList is being populated according to what the user types in the respective TextBox. In the Page Load, I’m doing the following (VB.NET):
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
FirstTextBox.Attributes.Add("onkeyup", "javascript:setTimeout('__doPostBack(\'" & FirstTextBox.ClientID & "\',\'\')', 0)")
FirstTextBox.Attributes.Add("onfocus", "javascript:setSelectionRange('" & FirstTextBox.ClientID & "','')")
FirstTextBox.Focus()
SecondTextBox.Attributes.Add("onkeyup", "javascript:setTimeout('__doPostBack(\'" & SecondTextBox.ClientID & "\',\'\')',0)")
SecondTextBox.Attributes.Add("onfocus", "javascript:setSelectionRange('" & SecondTextBox.ClientID & "','')")
SecondTextBox.Focus()
End Sub
The problem I’m having is that the user almost can’t type anything in the FirstTextBox because the focus goes to the SecondTextBox. What I would like to do is check if the focus is in the text box and then allow the code for this textbox. Something like: If (focus is on FirstTextBox) Then (do what is related to the FirstTextBox); If (focus is on the SecondTextBox) Then (do what is related to the SecondTextBox). Is this possible? What else can I do to make it work properly?
Thanks a lot,
Ana