enable button control with textbox textchanged event
Posted on 2013-12-03
Below is code for trying to change a button control for button.enabled = true and false depending on condition. I am trying to changed the enabled state of the button control when the text in a separate text box changes. When called the code fires but nothing happens on the page.
Can anyone help?
Protected Sub DataEntry1_TextChanged(sender As Object, e As EventArgs) Handles DataEntry1.TextChanged
If Not IsNumeric(DataEntry1.Text) Then
EnterDataBtn.Enabled = False
ViewState("BtnEnabled") = False
EnterDataBtn.Enabled = True
ViewState("BtnEnabled") = True