Click here to Skip to main content
15,881,424 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
I am using this Fancy box plugin to display a light box for confirm delete functionality.


C#
function fancyConfirm(msg, callback)
     {
         var ret;
         jQuery.fancybox({
             modal: true,
             //  content: "<div style=\"margin:1px;width:240px;\">" + msg + "<div style=\"text-align:right;margin-top:10px;\"><input id=\"fancyConfirm_cancel\" style=\"margin:3px;padding:0px;\" type=\"button\" value=\"Cancel\"><input id=\"fancyConfirm_ok\" style=\"margin:3px;padding:0px;\" type=\"button\" value=\"Unfollow\"></div></div>",
             content: "<div id=\"unfollower\"><div><table class=\"light_marg\"><thead><tr><td colspan=\"2\">Unfollow Project</td></tr></thead><tbody><tr><td colspan=\"2\">Are you sure you want to unfollow this project?</td></tr><tr><td></td><td><input id=\"fancyConfirm_ok\" class=\"btn btn-primary btn-large\" type=\"button\" value=\"Unfollow\"><input id=\"fancyConfirm_cancel\" style=\"margin:3px;padding:0px;\" type=\"button\" value=\"Cancel\" class=\"btn btn-primary btn-large\"> </td></tr></tbody></table></div></div>",
             afterShow: function()
             {
                 $("#fancyConfirm_cancel").click(function()
                 {
                     ret = false;
                     jQuery.fancybox.close();
                 })
                 jQuery("#fancyConfirm_ok").click(function()
                 {
                     ret = true;
                     jQuery.fancybox.close();
                 })
             },
             afterClose: function()
             {
                 if (typeof callback == 'function')
                 {
                     callback.call(this, ret);

                 }
             }


             //              function()
             //              {
             //                  callback.call(this, ret);
             //              }
         });

     }

     function fancyConfirm_text()
     {
         var src ;
        fancyConfirm("Are you sure you want to unfollow this project?", function(ret)
         {
             alert((ret));
            // alert(src+'-'+ret);
             src= ret;

         });





This is my on button click code on asp.net

XML
<asp:LinkButton ID="LnkBtnUnfollow" runat="server" CommandArgument ='<%# Eval("item_id")%>' OnClick="delete"   OnClientClick="return fancyConfirm_text(); " class="draft_link_tabs_but">Unfollow</asp:LinkButton>



So when i try to delete the particular row the page displays the light box for the confirmation i click yes/No but the page does not perform postback it is because i placed return false .
Posted

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900