I have a button with an onclick event
<asp:Button ID="btn_Save" runat="server" Text="Save" OnClick="btn_Save_Click"/>
I have a second onclick event for this button as it can be seen in below.
((Button)btn).Click += new EventHandler(SaveClicked);
I debugged and saw that the first one occurs before the second one,
I want to cancel the second onclick from the first one.
Why do I need 2 click events:
I have a webcontrol (BulkEditGridView), which takes a Button control as parameter, and this control saves whole rows. Second click event acts as save whole table. Now I added some fields to my webcontrol and I want to prevent saving when button is clicked. Since I can not modify the webcontrols eventhandler (second click event), I added the first onclick event. What I am tring to do is, prevent saving of the gridview, if one of the fields (ex: a textbox field) is empty, which can be done by prevent the default click event.
Session variable can be used .