asp.net - add sweet alert to LinkButton event -


i wondering if way combine sweet alert asp.net linkbutton. example have button delete row gridview , want fire sweet alert style

my code:

<asp:linkbutton id="linkbutton3" cssclass="btn btn-danger btn-sm" causesvalidation="false" commandname="delete" onclientclick="return confirm('are sure want remove item?');" runat="server"><span class="glyphicon glyphicon-trash"></span></asp:linkbutton> 

and sweet alert example:

swal({   title: "are sure?",   text: "you not able recover imaginary file!",   type: "warning",   showcancelbutton: true,   confirmbuttoncolor: "#dd6b55",   confirmbuttontext: "yes, delete it!",   closeonconfirm: false }, function(){   swal("deleted!", "your imaginary file has been deleted.", "success"); }); 

i have not figured way utilize gridview rowcommand function, instead pass id value sweetalert confirm function , post through hidden button.

function myconfirm(msgid) {         $("#<%=hfmsgid.clientid%>").val(msgid);         swal({             title: "are sure?",             text: "you not able recover message!",             type: "warning",             showcancelbutton: true,             confirmbuttoncolor: "#dd6b55",             confirmbuttontext: "yes, delete it!",             closeonconfirm: false         }, function () {             $("#<%=btndeletemsg.clientid%>").click();         });      }   <asp:hiddenfield id="hfmsgid" runat="server" /> <asp:button id="btndeletemsg" runat="server" cssclass="hidden" />   

in code behind, can execute hidden button's click event. access hidden field value id , reload/rebind after execution.


Comments

Popular posts from this blog

Hatching array of circles in AutoCAD using c# -

ios - UITEXTFIELD InputView Uipicker not working in swift -

Python Pig Latin Translator -