I have two buttons (ButtonA
& ButtonB
) and a textbox (TexboxA
) on an aspx page.
On the TexboxA
's blur, I call the Javascript event to click the ButtonA
programmatically.
My question is:
When I'm focussing on the
TextBoxA
, then I directly clicking theButtonB
, which onclick event fired first?ButtonA_Click
- since I'm losing focus of TextBoxA and triggering ButtonA click programmatically, orButtonB_Click
- because I'm directly clicking it?How to prevent
ButtonB_Click
triggered beforeButtonA_Click
completely finished?
Aspx Code:
<asp:TextBox ID="TextBoxA" runat="server" onblur="ClickA();"/>
<asp:Button ID="ButtonA" runat="server" OnClick="ButtonA_Click();"/>
<asp:Button ID="ButtonB" runat="server" OnClick="ButtonB_Click();"/>
JS Code:
function ClickA(){
document.getElementById('<%=ButtonA.ClientId%>').click();
}