﻿/* use this function when we have linkButton in Gridview */

function openConfirmDeletePopup(msg, controlId) {
   
    var theHREF = controlId.href;
    $("#dialog-message").dialog({
        modal: true,
        autoOpen: false,
        buttons: {
            No: function () {
                $(this).dialog("close");
                return false;

            },
            Yes: function () {

                $(this).dialog("close");
                window.location.href = theHREF;
                return true;

            }
        }
    });
    $("#dialog-message").dialog("open");

    if (msg != null) {
        $('#dialog-message > p > span#dm_msg').text(msg);
    }
    return false;
}


/*Use this function in front end when in gridview we have image button 
Reason when the page source generates it doesnot have javascript_doPostback like in LinkButton 
so we have to create the postback */
function FrontEndConfirmDeletePopup(msg, controlId) {
   
    var theHREF = controlId.name;
    var HREF = "javascript:__doPostBack('" + theHREF + "','')";
    $("#dialog-message").dialog({
        modal: true,
        autoOpen: false,
        buttons: {
            No: function () {
                $("#dialog-message").dialog("close");
                return false;

            },
            Yes: function () {
               
                $("#dialog-message").dialog("close");
                window.location.href = HREF;
                return true;

            }
        }
    });
    $("#dialog-message").dialog("open");

    if (msg != null) {
        $('#dialog-message > p > span#dm_msg').text(msg);
    }
    return false;
}
