TextChanged Event

chuspelycle

New Member
Every time I use the TextChanged event with autopostback set to true, it always sets focus back to the textbox that I call the TextChanged event from. Does anyone know how I can put the focus on the control that they clicked in before the event was triggered?I am not sure what you mean?<BR><BR>>it always sets focus back to the textbox that I call the >TextChanged event from.<BR>>Does anyone know how I can put the focus on the control that >they clicked in before the event was triggered?<BR><BR>In order to trigger the onTextChanged Event, don't you need to focus anyway on the textbox that calls the onTextChanged Event, so you can change the text?<BR><BR>Or maybe you have another scenario, please let us know exactly what you are trying to achieve.<BR><BR>I am using the ontextchanged event to make a checkbox visible or filter dropdowns based on the text the user just entered.The following code makes the checkbox visible if you type in 'true' into the textbox. Otherwise the checkbox is not visible.<BR><BR><script language = "vb" runat = "server"><BR>Sub CheckText(Sender as Object, byVal E as EventArgs)<BR> If myTextBox.Text = "true" Then<BR> myCheckBox.Visible = "true"<BR> else<BR> myCheckBox.Visible = "false"<BR> End If<BR>End Sub<BR></script><BR><BR><form id = "myForm" runat = "server"><BR><BR><asp:textbox id = "myTextBox" runat = "server" onTextChanged = "CheckText" autopostback = "true" /><BR><BR><BR><asp:checkbox id = "myCheckBox" visible = "false" runat = "server" /><BR></form>
 
Back
Top