Default.aspx
------------------
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default.aspx.cs" Inherits="DUMMY_Default" %>
<%@ Register TagPrefix="telerik" Namespace="Telerik.Web.UI" Assembly="Telerik.Web.UI" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head id="Head1" runat="server">
<title></title>
</head>
<body>
<form id="form1" runat="server">
<div>
<telerik:RadScriptManager runat="server" ID="RadScriptManager1" />
<asp:LinkButton ID="lnkbt1" runat="server" Text="Link1" OnClick="lnkbt1_Click"></asp:LinkButton>
<telerik:RadWindow ID="RadWindow2" runat="server" Height="300px" Width="300px" Left="500"
EnableShadow="true" Top="300" NavigateUrl="http://localhost:2607/Default2.aspx" VisibleOnPageLoad="false"
ShowContentDuringLoad="false" />
</div>
</form>
</body>
</html>
-----------------------------------------------------
Default.aspx.cs
-------------------
protected void lnkbt1_Click(object sender, EventArgs e)
{
lnkbt1.Text = "Clicked";
RadWindow2.VisibleOnPageLoad = true;
}
Default2.aspx
-----------------
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default2.aspx.cs" Inherits="DUMMY_Default2" %>
<%@ Register TagPrefix="telerik" Namespace="Telerik.Web.UI" Assembly="Telerik.Web.UI" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title></title>
<script type="text/javascript">
function GetRadWindow() {
var oWindow = null;
if (window.radWindow) oWindow = window.radWindow; //Will work in Moz in all cases, including clasic dialog
else if (window.frameElement.radWindow) oWindow = window.frameElement.radWindow; //IE (and Moz az well)
return oWindow;
}
function CloseOnReload() {
//alert("Dialog is about to close itself");
GetRadWindow().close();
RefreshParentPage();
}
function RefreshParentPage() {
//alert("Dialog is about to reload parent page");
GetRadWindow().BrowserWindow.location.reload();
}
function RedirectParentPage(newUrl) {
alert("Dialog is about to redirect parent page to " + newUrl);
GetRadWindow().BrowserWindow.document.location.href = newUrl;
}
function CallFunctionOnParentPage(fnName) {
alert("Calling the function " + fnName + " defined on the parent page");
var oWindow = GetRadWindow();
if (oWindow.BrowserWindow[fnName] && typeof (oWindow.BrowserWindow[fnName]) == "function") {
oWindow.BrowserWindow[fnName](oWindow);
}
}
function RefreshParentPageWithoutWarning() {
GetRadWindow().BrowserWindow.document.forms[0].submit();
}
</script>
</head>
<body>
<form id="form1" runat="server">
<div>
<asp:LinkButton ID="lnk2" runat="server" Text="Close" OnClick="lnk2_Click"></asp:LinkButton>
</div>
</form>
</body>
</html>
-------------------------------------------------------------------------
Default2.aspx.cs
-------------------
protected void lnk2_Click(object sender, EventArgs e)
{
Page page = HttpContext.Current.Handler as Page;
ScriptManager.RegisterStartupScript(page, page.GetType(), "err_msg", "CloseOnReload();", true);
}
0 comments:
Post a Comment