I have 2 pages named as :Abc.aspx and popupAbc.aspx
Now on Abc.aspx i have below button on click of which i am opening popupAbc.aspx as pop up:
<asp:Button ID="btnOpenChildAbcPopup" runat="server" Text="Open" UseSubmitBehavior="false" CausesValidation="False" OnClick="btnOpenChildAbcPopup_Click" />
Code Behind:
protected void btnOpenChildAbcPopup_Click(object sender, EventArgs e)
{
string url="../popupAbc.aspx";
ScriptManager.RegisterStartupScript(Page, GetType(), "alert", "OpenChildAbcPopup('" + url + "');",
true);
}
function OpenChildAbcPopup(url) {
$.fancybox({
'onStart ': function () { $.fancybox.hideActivit() },
'onComplete': function () { $.fancybox.hideActivity() },
'titleShow': 'true',
'titlePosition': 'over',
'titleFormat': 'formatTitle',
'href': url,//popupAbc.aspx
'type': 'iframe',
'width': '1000',
'height': '500',
'fitToView': false,
'autoSize': false,
'hideOnOverlayClick': false,
'hideOnContentClick': false,
'overlayOpacity': 0.7,
'enableEscapeButton': false,
'closeEffect': 'none'
});
$.fancybox.hideLoading();
return false;
}
Here up till now everythings works perfectly and on click of button my popupAbc.aspx
opens perfectly in pop up box but problem is with in this popupAbc.aspx
.
i have one button in popupAbc.aspx
in which i will save some data and after saving data i would like to again call the
javascript function which is on master page but that javascript function is not calling.
This is my page:popupAbc.aspx
<%@ Page Language="C#" AutoEventWireup="true" MasterPageFile="~/MyMaster.Master" CodeBehind="popupAbc.aspx.cs" Inherits="popupAbc.aspx" %>
<asp:Button ID="btnSubmit" runat="server" Text="Save" OnClick="btnSubmit_Click" UseSubmitBehavior="true" ValidationGroup="p1" />
protected void btnSubmit_Click(object sender, EventArgs e)
{
//code for saving form data in database and after that call javascript function which
//is on MyMaster page
ScriptManager.RegisterStartupScript(Page, GetType(), "Js", "ExitMyCurrentFancyBox();", true);
}
But in firebug console it is throwing error that ExitMyCurrentFancyBox is not defined.
When i put this ExitMyCurrentFancyBox function in my popupAbc.aspx
then it is calling successfully but when i put this on my master page then it is not calling.
function ExitMyCurrentFancyBox() {
alert()
}
Note:My Abc.aspx uses update panel
and popupAbc.aspx doesnt uses update panel
.
Can anybody tell me why that Javascript function is not calling when i put it on master page and how to call it when it is on master page??
I have tried all this but still any of below is not working:
// ScriptManager.RegisterStartupScript(Page, GetType(), "alert", "ExitMyCurrentFancyBox();", true);
// ScriptManager.RegisterStartupScript(Page, GetType(), "alert", "ExitMyCurrentFancyBox();", true);
//ClientScript.RegisterClientScriptBlock(GetType(), "sas", "CloseFancyboxtl();", true);
// ScriptManager.RegisterStartupScript(this, this.GetType(), "ntmtch", "ExitMyCurrentFancyBox();", true);
// ScriptManager.RegisterStartupScript(Page, Page.GetType(), "msg", "ExitMyCurrentFancyBox();", true);
//ScriptManager.RegisterStartupScript(this, this.GetType(), "msg", "ExitMyCurrentFancyBox;", true);
ScriptManager.RegisterClientScriptBlock(this.Page, GetType(), Guid.NewGuid().ToString(), "ExitMyCurrentFancyBox();", true);