I have textboxes and a button.
The button uses a value which is manipulated by the textbox textchanged event.
I don't want the button click event to be fired before the value is changed by the textbox changed event.
void tprice_TextChanged(object sender, EventArgs e) {
idtextbox tsender = (idtextbox)sender;
decimal value = 0;
decimal.TryParse(tsender.Text, out value);
if (area_updates.ContainsKey(tsender.id)) { area_updates[tsender.id].price = value; }
else { area_updates.Add(tsender.id, new area_update(tsender.id) { price = value }); }
Session["area_updates"] = area_updates;
}
protected void bsave_Click(object sender, EventArgs e) {
}
Afaik there is no way to ensure the event order TextChanged
->ButtonClick
.
You should use a different approach.
TextChanged
logic into the ButtonClick
event orTextBox
AutoPostBack=true
, but this requires an additional postback So i would suggest to put the logic into the ButtonClick
- and remove the TextChanged
event.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With