JabbaTheNut
Programmer
I have a dropdown list named "mySelect" that has three items indexed as 0,1,2.
I also have a textbox named "myTextBox".
I want myTextBox to be disabled and grayed out when mySelect.SelectedIndex=0
I am using the following code-behind which is attached to a "Submit" button on the web form...
If mySelect.SelectedIndex = 0 then
myTextBox.Text = ""
myTextBox.BackColor = System.Drawing.Color.Gray
myTextBox.Enabled = False
End If
The problem is as follows:
If the user selects mySelect.SelectedIndex = 1 (or 2) and clicks the Submit button, myTextBox.Text does not change to "" (as expected); however, myTextBox.BackColor does change to gray and myTextBox is disabled (not supposed to happen).
I thought my setup seemed fairly straight forward. But I am clearly missing something here. Why is the textbox color changing and the control becoming disabled when item 0 is not selected? Please help. Thanks Game Over, Man!
I also have a textbox named "myTextBox".
I want myTextBox to be disabled and grayed out when mySelect.SelectedIndex=0
I am using the following code-behind which is attached to a "Submit" button on the web form...
If mySelect.SelectedIndex = 0 then
myTextBox.Text = ""
myTextBox.BackColor = System.Drawing.Color.Gray
myTextBox.Enabled = False
End If
The problem is as follows:
If the user selects mySelect.SelectedIndex = 1 (or 2) and clicks the Submit button, myTextBox.Text does not change to "" (as expected); however, myTextBox.BackColor does change to gray and myTextBox is disabled (not supposed to happen).
I thought my setup seemed fairly straight forward. But I am clearly missing something here. Why is the textbox color changing and the control becoming disabled when item 0 is not selected? Please help. Thanks Game Over, Man!