PDA

View Full Version : [CLOSED] Send Params to window



FpNetWorth
Sep 14, 2012, 9:00 AM
Hi,

I want to open a window and send parameters to it.
The code that I use works with Ext.net 1.3, but when I tried to switch to version 2, I can't receive the parameter.
Please find below my code:

Parent page:


<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="Parent.aspx.cs" Inherits="MyProject.WindowGridPanel.Parent" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<%@ Register Assembly="Ext.Net" Namespace="Ext.Net" TagPrefix="ext" %>
<html xmlns="http://www.w3.org/1999/xhtml">
<head id="Head1" runat="server">
<script language="javascript" type="text/javascript">
function showWindow() {
var win = myResource.employeeWindow;
win.loader.params.txtToSend = myResource.text.getValue();
alert(win.loader.params.txtToSend); // I get the text with the right value!!
win.show(); // The window opens !!
}

</script>
<title></title>
</head>
<body id="Body1" runat="server">
<form id="form1" runat="server">
<div>
<ext:ResourceManager ID="ResourceManager1" runat="server" Namespace="myResource" />

<ext:Button ID="Button1" runat="server" Text="open window">
<Listeners>
<Click Handler="showWindow()" />
</Listeners>
</ext:Button>
<ext:TextArea ID="text" runat="server">
</ext:TextArea>
</div>
</form>
<ext:Window ID="employeeWindow" ClientIDMode="Static" runat="server" Resizable="false"
Icon="ApplicationFormEdit" Width="380" Height="330" Hidden="true" Modal="true"
Constrain="false">
<Loader Mode="Frame" ID="Loader1" runat="server" AutoLoad="true" Url="child.aspx">
<Params>
<ext:Parameter Mode="Value" Name="txtToSend" />
</Params>
</Loader>
</ext:Window>
</body>

</html>


Child parent ( window's page)


protected void Page_Load(object sender, EventArgs e)
{
string selectedIds = Request.QueryString["txtToSend"]; // selectedIds is empty !!
}

Daniil
Sep 14, 2012, 12:07 PM
Hi,

A load request with empty parameter is already made before Window showing.

So, when you call the show method, no request occurs.

I would suggest you to:

1. Set

AutoLoad="false"
for the Loader.

2. Change your function to:

function showWindow() {
var win = myResource.employeeWindow;

win.show();
win.load({
params: {
txtToSend : "hello!"
}
});
}

If you need the Window to be reloaded on each showing you can configure the Loader in a respective way setting its TriggerEvent and ReloadOnEvent properties.