Mar 14, 2011, 3:24 PM
[CLOSED] Passing information from Popup window to parent window throwing error
Hi,
I am implementing small basic project with 4 pages. While opening popup window I have to pass one field value to parent window field. It is throwing error. The popup window is creating dynamically, and button and text field created in parent window dynamically. Please check following code. This the scenario in my project. And finally once open popup and close ('X') and then open again I can't close the popup.
The Common Page
I am implementing small basic project with 4 pages. While opening popup window I have to pass one field value to parent window field. It is throwing error. The popup window is creating dynamically, and button and text field created in parent window dynamically. Please check following code. This the scenario in my project. And finally once open popup and close ('X') and then open again I can't close the popup.
The Common Page
<%@ Page Language="VB" %>
<%@ Register Assembly="Ext.Net" Namespace="Ext.Net" TagPrefix="ext" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<script runat="server">
Public Sub btnSearchExistingLoans_Click(ByVal sender As Object, ByVal e As Ext.Net.DirectEventArgs)
'Me.pnlMain.LoadContent("TestPage.aspx")
End Sub
</script>
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title></title>
<script type="text/javascript">
var renderWindow = function (windowConfig) {
new Ext.Window(windowConfig);
}
</script>
</head>
<body>
<form id="form1" runat="server">
<ext:ResourceManager ID="ResourceManager1" runat="server" />
<ext:Viewport ID="Viewport1" runat="server" Layout="border">
<Items>
<ext:Panel ID="pnlTops" runat="server" Region="North" Height="80">
<Items>
<ext:Panel ID="pnlHeader" runat="server" Border="false">
<Items>
<ext:Toolbar ID="tbHeader" runat="server" AnchorVertical="top">
<Items>
<ext:Label ID="btnPowerbyAtlos" runat="server" AnchorHorizontal="left" Icon="Application"
Text="My Company">
</ext:Label>
<ext:ToolbarFill />
<ext:Label ID="lblWelcome" runat="server" Text="Welcome : ">
</ext:Label>
<ext:Label ID="lblUser" runat="server" Text="User">
</ext:Label>
<ext:ToolbarSeparator />
<ext:Button ID="btnEditProfile" runat="server" AnchorHorizontal="right" Text="My Profile"
Icon="UserEdit">
</ext:Button>
<ext:ToolbarSeparator />
<ext:Button ID="btnHelp" runat="server" AnchorHorizontal="right" Text="Help" Icon="Help">
</ext:Button>
</Items>
</ext:Toolbar>
</Items>
</ext:Panel>
<ext:TabPanel ID="tbNavigation" runat="server" Height="55" AnchorHorizontal="100%" Border="false">
<Items>
<ext:Panel ID="pnlNewLoan" runat="server" Title="My Administration" Padding="0" Border="false">
<Items>
<ext:Toolbar ID="tbPageNewLoan" runat="server" AnchorHorizontal="100%">
<Items>
<ext:Button ID="btnSearchExistingLoans" Text="Admin Page1" runat="server"
Icon="ApplicationViewDetail">
<DirectEvents>
<Click OnEvent="btnSearchExistingLoans_Click">
</Click>
</DirectEvents>
</ext:Button>
</Items>
</ext:Toolbar>
</Items>
</ext:Panel>
</Items>
</ext:TabPanel>
</Items>
</ext:Panel>
<ext:Panel ID="pnlMain" runat="server" Padding="5" Region="Center">
<AutoLoad Url="MyDefaultPage.aspx" Mode="IFrame" NoCache="true"/>
</ext:Panel>
</Items>
</ext:Viewport>
</form>
</body>
</html>
The Default Page<%@ Page Language="VB" %>
<%@ Register Assembly="Ext.Net" Namespace="Ext.Net" TagPrefix="ext" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<script runat="server">
Public Sub MoveToAnother(ByVal sender As Object, ByVal e As DirectEventArgs)
Response.Redirect("TestPage.aspx")
End Sub
</script>
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title></title>
</head>
<body>
<form id="form1" runat="server">
<ext:ResourceManager ID="ResourceManager1" runat="server" />
<div>
<ext:Viewport runat="server" Layout="border">
<Items>
<ext:Panel runat="server" ID="pnlSearchResults" Height="53" Region="Center">
<Items>
<ext:Toolbar ID="tbSearchResults" runat="server" AnchorVertical="top">
<Items>
<ext:Button ID="btnDeleteSelected" runat="server" AnchorHorizontal="left" Text="Move to Other"
Icon="ApplicationOsxDelete">
<DirectEvents>
<Click OnEvent="MoveToAnother">
</Click>
</DirectEvents>
</ext:Button>
<ext:ToolbarFill />
</Items>
</ext:Toolbar>
</Items>
</ext:Panel>
</Items>
</ext:Viewport>
</div>
</form>
</body>
</html>
Test Page
<%@ Page Language="VB" AutoEventWireup="false" CodeFile="TestPage.aspx.vb" Inherits="TestPage" %>
<%@ Register Assembly="Ext.Net" Namespace="Ext.Net" 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 runat="server">
<title></title>
<script type="text/javascript">
var ShowReqCondsWindow = function (statusval, keystr, statusid) {
//alert("Here");
var windowConfig = {
id: "WindowReqCond",
title: "Required Fields",
height: 530,
width: 700,
hidden: false,
closeAction: "hide",
iconCls: "icon-pagewhitecode",
autoLoad: {
url: "TestPopup.aspx",
mode: "iframe",
showMask: true,
params: {
LOAN_STATUS_ID_VAL: statusval,
keystring: keystr,
KEYVAL: statusid
}
}
}
parent.parent.renderWindow(windowConfig);
}
</script>
</head>
<body>
<form id="form1" runat="server">
<ext:ResourceManager ID="ResourceManager1" runat="server" />
<div>
<ext:Viewport runat="server" Layout="border">
<Items>
<ext:Panel ID="pnlCtrls" runat="server" Region="Center" Padding="10">
</ext:Panel>
</Items>
</ext:Viewport>
</div>
</form>
</body>
</html>
Code Behind
Partial Class TestPage
Inherits System.Web.UI.Page
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
Call CreateButtonsAndTextFields()
End Sub
Public Sub CreateButtonsAndTextFields()
Dim btnFirst As Ext.Net.Button
Dim txtDateField As Ext.Net.TextField
btnFirst = New Ext.Net.Button
btnFirst.ID = "btnFirst1"
btnFirst.Text = "Open Popup"
btnFirst.Width = Unit.Pixel(200)
btnFirst.Listeners.Click.Handler = "ShowReqCondsWindow('" & btnFirst.Text & "','Test_1','1')"
txtDateField = New Ext.Net.TextField
txtDateField.ID = "txtDataField1"
'txtDateField.Text = "Loan Status Date"
txtDateField.EmptyText = "Waiting for Update..."
pnlCtrls.Items.Add(btnFirst)
pnlCtrls.Items.Add(txtDateField)
End Sub
End Class
The popup page<%@ Page Language="VB" AutoEventWireup="false" CodeFile="TestPopup.aspx.vb" Inherits="TestPopup" %>
<%@ Register Assembly="Ext.Net" Namespace="Ext.Net" 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 runat="server">
<title></title>
</head>
<body>
<form id="form1" runat="server">
<ext:ResourceManager ID="ResourceManager1" runat="server" />
<div>
<ext:Viewport runat="server" Layout="Border">
<Items>
<ext:Panel ID="pnlPopupCtrls" runat="server" Region="Center">
<Items>
<ext:Panel ID="pnlCenter" runat="server" Html="Popup window panel">
<Items>
<ext:TextField ID="txtFieldVal" runat="server"></ext:TextField>
</Items>
</ext:Panel>
</Items>
<Buttons>
<ext:Button ID="btnSave" Text="Save" Icon="Disk" runat="server">
<Listeners>
<Click Handler="parent.txtDataField1.SetVale(txtFieldVal.GetText())" />
</Listeners>
</ext:Button>
<ext:Button ID="btnClose" Text="Close" Icon="Cancel" runat="server">
<Listeners>
<Click Handler="WindowReqCond.hide()" />
</Listeners>
</ext:Button>
</Buttons>
</ext:Panel>
</Items>
</ext:Viewport>
</div>
</form>
</body>
</html>
Code behind it is nothing Partial Class TestPopup
Inherits System.Web.UI.Page
End Class
Last edited by Daniil; Mar 21, 2011 at 7:10 PM.
Reason: [CLOSED]