Imagine the following situation:
<asp:TextBox ID="txt" runat="server" AutoPostBack="true" OnTextChanged="txt_TextChanged"></asp:TextBox>
<asp:Button ID="btn" runat="server" OnClick="btn_Click" CausesValidation="false" UseSubmitBehavior="false" />
when displayed, those two controls turn into:
<input name="txt" type="text" onchange="javascript:setTimeout('__doPostBack(\'txt\',\'\')', 0)" onkeypress="if (WebForm_TextBoxKeyHandler(event) == false) return false;" id="txt">
<input type="button" name="btn" onclick="javascript:__doPostBack('btn','')" id="btn">
thanks to setTimeout, the Click event is triggered before the Change event.
During my investigation, I found out that ASP.NET does this due to an old issue in some outdated versions of IE.
Nevertheless, this poses issues because when my button click conceals the textbox, it leads to some "Invalid postback or callback" errors.
How can I adjust the sequence of events so that TextChanged always occurs prior to Click?
PS: I am open to utilizing Javascript/jQuery to modify one of the events, but I have concerns about the performance implications of these solutions (as I might need to use eval).