Calling ASP.NET codebehind function from Jquery or making Jquery window modal?

Calling ASP.NET codebehind function from Jquery or making Jquery window modal?

 

I'm working on a .NET-based (VB) collections program. There is a page in the system where users set up new cases, and at several points on this page they are taken to a different page to define certain selections on the case, causing us to save a partial record before navigating away to the next page. I want to warn them of this and give them the chance to continue or cancel. If they select continue a function in the codebehind file is run.  If they select cancel I just want the Jquery warning window to close and return to the calling page. I'm using an ASP linkbutton to run a function in the codebehind page on the onclick event.  We can't do a simple redirect, we have to do some "stuff" before redirecting.

I have defined a Jquery window with the continue and cancel buttons and it comes up but is not working in a modal fashion - it flashes on and off instantly and then execution continues on to the function in the onclick event.  I thought about using a blank href, but I'm not sure how to call the .NET function in the codebehind from Jquery or Ajax.  This is my first Jquery-related project and I've tried many things but can't seem to get over this wall, and have not been able to find any Jquery examples on the net that mimic what I'm trying to do.  Any help would be greatly appreciated!

Following is the relevant code:

ASP linkbutton

<asp:linkbutton id="lnbEditAct" runat="server" OnClick="lnbEditAct_Click">Edit/Change Table</asp:linkbutton>

This Jquery function is at the top of the .aspx page and calls another function (warn_save) in an included .js file.

<script language="javascript">
            $(document).ready(function() {
                $("#lnbEditAct").click(function() {
                    warn_save();
                })
            })
    </script>   





The warn_save function in the .js file referenced via a <script> tag.

function warn_save() {
    // show modal div
    $("html").css("overflow", "hidden");
    $("body").append("<div id='popup_overlay'></div><div id='popup_window'></div>");
    $("#popup_overlay").addClass("popup_overlayBG");
    $("#popup_overlay").fadeIn("slow");
   
    // build warning box
    $("#popup_window").append("<h1>Save Case?</h1>");
    $("#popup_window").append("<p id='popup_message'><center>Navigating away from the current page will automatically save this Case.  Are you sure you want to continue?</center></p>");
    $("#popup_window").append("<div class='buttons'><center><button id='continue' class='positive' type='submit'><img src='images/green-checkmark.png' alt=''/>Yes</button>&nbsp;<button id='cancel' class='positive' type='submit' alt=''><img src='images/delete.png' alt=''/>No</button></center></div>");

    // attach action to button
    $("#continue").click(save_continue);
    $("#cancel").click(save_abort);
   
    // display warning window
    popup_position(400,300);
    $("#popup_window").css({display: "block"}); //for safari using css instead of show
    $("#continue").focus();
    $("#continue").blur();
}






















The save_continue and save_abort functions.

      // call from continue button

     function save_continue() {
        popup_remove();
        MyNamespace.MyPage.lnbEditAct_Click();
}

    // call from cancel button click
    function save_abort() {
        popup_remove();
}







I've left my attempt to call the codebehind function in the save_continue Jquery function......I've tried using a blank href and relying on the function to be called here and that didn't work either, but from a process flow standpoint this is what I'm trying to accomplish. So the $64,000 question is how do I make the Jquery window pause execution of the codebehind function until the user makes their selection, or as an alternative, how can I call the codebehind function from Jquery instead of defining it in the onclick event of the linkbutton?

TIA,

Mike