I have a difficult scenario here. Previously I have tried to post something
similar here, unfortunately I got no solution.
For simplicity I have created something simple to simulate my problem.
I have a simple webform that goes,
________________
dropdownlist --> |_____________|V| [label3]
______________
text box 1 ---> |______________| [label1]
______________
text box 2 ----> |_____________| [label2]
___________________
|UpdateLabelAndLabel2|
A DropDownList With A Label "Label3" beside it
2 textboxes with Labels 1 and 2 beside them respectively
A UpdateLabel1AndLabel2 Button
The dropdownlist has a few predefined options and 'AutoPostBack="True" '
The TextBox1 has ' OnTextChanged="HandleTextBox1Event" AutoPostBack="False" '
TextBox2 has ' OnTextChanged="HandleTextBox2Event" AutoPostBack="False" '
The Button submits the form
the event handlers are as follows:
Private Sub DropDownList_SelectedIndexChanged(ByVal sender As System.Object,
ByVal e As System.EventArgs) Handles
DropDownList.SelectedIndexChanged
Label3.Text = sender.SelectedValue
End Sub
Public Sub HandleTextBox1Event(ByVal Sender As Object, ByVal e As EventArgs)
Label1.Text = Sender.text
End Sub
Public Sub HandleTextBox2Event(ByVal Sender As Object, ByVal e As EventArgs)
Label2.Text = Sender.text
End Sub
When I make changes to the text in the textboxes and click the button, the
event handlers handling the TextChanged event would update the labels' text.
This is ok. but when I make changes to the text in the textboxes and then
select a value in the dropdownlist instead of clicking the button, the
TextChanged events fired as well, as a result of the postback caused by the
dropdownlist's SelectedIndexChanged event. so the question here is, I need
the dropdownlist to postback so that i can get its selected value but i dont
want the textboxes' TextChanged events to affect the labels as a result of
the postback caused by the dropdownlist instead of the button.
i need to use textchanged event handlers in my webform because the original
problem lies with mass editing of rows in a repeater with textboxes and
checkboxes. Help will be much appreciated.
Regards,
Solitus