Click here to Skip to main content
Rate this: bad
good
Please Sign up or sign in to vote.
I am using this Fancy box plugin to display a light box for confirm delete functionality.
 

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
 
<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 30-Jan-13 0:02am

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

  Print Answers RSS
0 OriginalGriff 584
1 Maciej Los 275
2 DamithSL 233
3 Sergey Alexandrovich Kryukov 209
4 BillWoodruff 200
0 OriginalGriff 6,803
1 Sergey Alexandrovich Kryukov 6,377
2 DamithSL 5,421
3 Manas Bhardwaj 4,841
4 Maciej Los 4,330


Advertise | Privacy | Mobile
Web03 | 2.8.1411023.1 | Last Updated 30 Jan 2013
Copyright © CodeProject, 1999-2014
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100