views:

228

answers:

0

I have a popup opened using NyroModal plugin to logout of the application. In the Popup when the button is clicked RaiseCallbackEvent event in the codebehind in popup is not executed.

PopUp Code:

<script src="../Scripts/jquery-1.3.2.js" type="text/javascript"></script>
<script src="../Scripts/jquery.nyroModal-1.5.5.js" type="text/javascript"></script>
<script src="../Scripts/jquery.nyroModal.urlplugin-0.0.1.pack.js" type="text/javascript"> </script>
<script type="text/javascript">"
        $(function(){
            $('#btnYes').click(function(e){                             
                e.preventDefault(); 
                Logout();
                window.parent.location.reload();
                top.$('#frmInside').hide(function(){                    
                    top.$.nyroModalRemove();
                    return true;
                });                
            });                        
        });

        function Logout()
        {UserCallback();}

        function ServerData(arg, Context)
        {alert("logout!"+arg);}
    </script>

    <form id="frmInside" runat="server">
    <strong>Are you sure you want to Logout?</strong></p>
    <asp:ImageButton ID="btnYes" runat="server" ImageUrl="../img/b-yes.png" />or&nbsp;&nbsp;<a class="nyroModalClose" href="#" title="close">No!</a>
    </form>

PopUp Codebehind:

public partial class P_LogoutInside : System.Web.UI.Page, ICallbackEventHandler
{
    string sPath = string.Empty;
    protected void Page_Load(object sender, EventArgs e)
    {
        ClientScriptManager cm = Page.ClientScript;
        string cbRef = cm.GetCallbackEventReference(this, "arg", "ServerData", "Context");

        string cbScript = "function UserCallback(arg,Context){" + cbRef + "}";
        cm.RegisterClientScriptBlock(this.GetType(), "UserCallback", cbScript, true);
    }

    public void RaiseCallbackEvent(string eventArgument)
    {
        Session.Abandon();
        string path = Request.ServerVariables["URL"];
        sPath = path;
    }

    public string GetCallbackResult()
    {
        return sPath;
    }
}

Above code works fine when the popup launching page and popup page are in same folder. Problem is when the launching page and the popup page are in different folders and then RaiseCallbackEvent in popup codebehind file doesn't execute.

I have tried all possible options. Even postback does not work in the above situation. Am I going wrong anywhere or this process of callback is not suggestible. If there is any other method or solution. please suggest.

Please help...Thanks in Advance...