Jul 24, 2009, 6:12 AM
[CLOSED] Executing actions on closing dinamically created windows
Hello,
I have make a simple example illustrating what I want to do. (and I am not able to find how to do it)
1- I have a main page which contains a panel which shows an specific url
2- I open a dinamically created window which contains another page
3- from inside the page of the dinamically created window, I want to refresh/change the url of the panel in the main window (i.e. combined with the closing of the window, the actions done in the closed window alters the information, so the frame in the main window should be refreshed)
What I do not know how to do is how to refresh /change the url of the panel in the main page wron the page in the window.
The idea is that the "Close window" button also reload/change the url of the "myWebPanel" panel in the main page.
Any ideas about how to do that?
Thank you.
Here is the code
Main.aspx
I have make a simple example illustrating what I want to do. (and I am not able to find how to do it)
1- I have a main page which contains a panel which shows an specific url
2- I open a dinamically created window which contains another page
3- from inside the page of the dinamically created window, I want to refresh/change the url of the panel in the main window (i.e. combined with the closing of the window, the actions done in the closed window alters the information, so the frame in the main window should be refreshed)
What I do not know how to do is how to refresh /change the url of the panel in the main page wron the page in the window.
The idea is that the "Close window" button also reload/change the url of the "myWebPanel" panel in the main page.
Any ideas about how to do that?
Thank you.
Here is the code
Main.aspx
<%@ Page Language = "C#"%>
<%@ Register Assembly="Coolite.Ext.Web" Namespace="Coolite.Ext.Web" TagPrefix="ext" %>
<!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>
<script runat="server">
protected void Page_Load(object sender, EventArgs e)
{
Coolite.Ext.Web.Button btncreate=new Coolite.Ext.Web.Button();
btncreate.Text="Create Window";
btncreate.StyleSpec="margin: 2px;";
btncreate.MinWidth=100;
string script="newWindow('window.aspx', {id: 'LKF_00000FGT',title: 'Test window', height: 200, width: 300, modal:true});";
btncreate.OnClientClick=script;
Form.Controls.Add(btncreate);
//panel with an url
Coolite.Ext.Web.Panel webpanel=new Coolite.Ext.Web.Panel();
webpanel.ID="myWebPanel";
webpanel.Height=300;
webpanel.Width=600;
webpanel.AutoLoad.Url="http://www.ext.net";
webpanel.AutoLoad.Mode= LoadMode.IFrame;
webpanel.AutoLoad.MaskMsg="Loading...";
webpanel.AutoLoad.ShowMask=true;
Form.Controls.Add(webpanel);
//this is the action that I want to be performed from the opened window
Coolite.Ext.Web.Button btnchangeURL=new Coolite.Ext.Web.Button();
btnchangeURL.Text="Change URL and reload";
btnchangeURL.StyleSpec="margin: 2px;";
btnchangeURL.MinWidth=100;
script="#{myWebPanel}.load({url:\"http://www.google.com\"});";
btnchangeURL.OnClientClick=script;
Form.Controls.Add(btnchangeURL);
}
</script>
<script type="text/javascript">
var newWindow = function (url, config) {
new Ext.Window(Ext.apply({
renderTo: Ext.getBody(),
resizable: false,
title: "Test",
height: 500,
width: 500,
frame: true,
autoLoad: {
maskMsg: "Loading...",
showMask: true,
mode: "iframe",
url: url
}
}, config)).show();
}
</script>
</head>
<body>
<form id="form1" runat="server">
<ext:ScriptManager ID="scriptManager" runat="server"/>
</form>
</body>
</html>
window.aspx<%@ Page Language = "C#"%>
<%@ Register Assembly="Coolite.Ext.Web" Namespace="Coolite.Ext.Web" TagPrefix="ext" %>
<!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>
<script runat="server">
protected void Page_Load(object sender, EventArgs e)
{
Coolite.Ext.Web.Button btnclose=new Coolite.Ext.Web.Button();
btnclose.Text="Close Window";
btnclose.StyleSpec="margin: 2px;";
btnclose.MinWidth=100;
string script="parent.window.LKF_00000FGT.close();";
//the following line does not work :(
script+="parent.window.#{myWebPanel}.load({url:\"http://www.google.com\"});";
btnclose.OnClientClick=script;
Form.Controls.Add(btnclose);
}
</script>
</head>
<body>
<form id="form1" runat="server">
<ext:ScriptManager ID="scriptManager" runat="server"/>
</form>
</body>
</html>