ButtonField = Image No OnClientClick

159 views Asked by At

I want a confirm prompt on this button type. There is no OnClientClick for this button type and I need an alternative method on how.

     <asp:ButtonField ButtonType="Image" ImageUrl="Content/Images/Edit.png" CommandName="EditRow" Visible="true" CausesValidation="false" ItemStyle-CssClass="smallColumn" ControlStyle-Width="15" ControlStyle-Height="15" />

Is there a way I can use Jquery to intercept the button click; prompt the user then if the user says no prevent button click?

1

There are 1 answers

5
Laserson On

Yes, you can attach a click handler using jQuery:

$("#YOUR_BTN_ID").click(function() { if(confirm('YOUR REQUEST HERE') { doSomething(); }));