PDA

View Full Version : [CLOSED] QueryString Dropped between files using frame loader



ljankowski
Jan 15, 2014, 1:42 PM
I have a main file(file1.aspx) that contains 2 windows with loaders to separate files(file2.aspx and file3.aspx). Based on a method in file2.aspx, a directMethod is called on file1.aspx, passing to it a JSON string. In that file, the same JSON string is passed to file3.aspx as a querystring. The first time that file 3 is accessed, the querystring only contains "[{" , and nothing else. On subsequent loads it works as expected. Please see example code below.

File1.aspx


<ext:Window runat="server"
ID="File2Window"
Title="File2"
Hidden="true"
Width="650">
<Loader runat="server"
ID="File2WindowLoader"
Mode="Frame"
AutoLoad="false" />
</Window>
<ext:Window runat="server"
ID="File3Window"
Title="File3"
Hidden="true"
Width="650">
<Loader runat="server"
ID="File3WindowLoader"
Mode="Frame"
AutoLoad="false" />
</Window>



File1.aspx.cs


[DirectMethod]public void LoadFile3(string JsonString)
{
File3Window.Loader.Url = string.Format("file3.aspx?JsonString={0}", JsonString);
File3Window.LoadContent();
File3Window.Show();
}


File2.aspx.cs(HeaderList is a List<T>)


X.Js.Call("parent.App.direct.dmLoadFile3(" + Ext.Net.JSON.Serialize(HeaderList) + ")");


File3.aspx.cs


protected void Page_Load(object sender, EventArgs e)
{
FillComboBox(Request.QueryString["JsonString"]);
}


protected void FillComboBox(string JsonString)
{
Dictionary<string, string>[] Headers = JSON.Deserialize<Dictionary<string, string>[]>(JsonString);


...do other stuff
}


The value is passed from File2 to File1 properly every time, and when debugging, the File3Window.Loader.Url appears correct, but on the first load of File3, the JsonString is "[{".

Thanks in advance for your help.

Daniil
Jan 16, 2014, 2:57 AM
Hi @ljankowski,

Hard to say what is wrong. Could you, please, provide a full test case?

ljankowski
Jan 16, 2014, 12:42 PM
Hope this helps.

umManageExisting.aspx


<ext:GridPanel runat="server" ID="uxManageGrid" Region="North" Layout="HBoxLayout">
<SelectionModel>
<ext:RowSelectionModel ID="RowSelectionModel1" runat="server" AllowDeselect="true" Mode="Single" />
</SelectionModel>
<Store>
<ext:Store runat="server" AutoDataBind="true" ID="uxManageGridStore" OnReadData="deReadHeaderData" PageSize="10">
<Fields>
<ext:ModelField Name="HEADER_ID" Type="String" />
<ext:ModelField Name="PROJECT_ID" Type="String" />
<ext:ModelField Name="DA_DATE" Type="Date" />
<ext:ModelField Name="SEGMENT1" Type="String" />
<ext:ModelField Name="LONG_NAME" Type="String" />
<ext:ModelField Name="STATUS_VALUE" Type="String" />
<ext:ModelField Name="WARNING" Type="String" />
</Fields>
<Proxy>
<ext:PageProxy />
</Proxy>
</ext:Store>
</Store>
<ColumnModel>
<Columns>
<ext:DateColumn runat="server" Text="Activity Date" DataIndex="DA_DATE" Flex="10" Format="MM-dd-yyyy">
<HeaderItems>
<ext:DateField runat="server" Format="MM-dd-yyyy" />
</HeaderItems>
</ext:DateColumn>
<ext:Column ID="Column1" runat="server" Text="Project" DataIndex="SEGMENT1" Flex="20"/>
<ext:Column runat="server" Text="Project Name" DataIndex="LONG_NAME" Flex="50" />
<ext:Column runat="server" Text="Status" DataIndex="STATUS_VALUE" Flex="30" />
</Columns>
</ColumnModel>
<BottomBar>
<ext:PagingToolbar runat="server" />
</BottomBar>
<Plugins>
<ext:FilterHeader runat="server" Remote="true" DateFormat="MM-dd-yyyy" />
</Plugins>
<TopBar>
<ext:Toolbar runat="server">
<Items>
<ext:Button runat="server"
ID="uxSubmitActivityButton"
Text="Submit for Approval"
Icon="ApplicationGo"
Disabled="true">
<DirectEvents>
<Click OnEvent="deSubmitActivity">
<ExtraParams>
<ext:Parameter Name="HeaderId" Value="#{uxManageGrid}.getSelectionModel().getSelection()[0].data.HEADER_ID" Mode="Raw" />
</ExtraParams>
</Click>
</DirectEvents>
</ext:Button>
<ext:ToolbarSpacer ID="ToolbarSpacer2" runat="server" />
<ext:Button runat="server"
ID="uxApproveActivityButton"
Text="Approve"
Icon="ApplicationPut"
Disabled="true">
<DirectEvents>
<Click OnEvent="deApproveActivity">
<ExtraParams>
<ext:Parameter Name="HeaderId" Value="#{uxManageGrid}.getSelectionModel().getSelection()[0].data.HEADER_ID" Mode="Raw" />
</ExtraParams>
</Click>
</DirectEvents>
</ext:Button>
<ext:ToolbarSpacer ID="ToolbarSpacer1" runat="server" />
<ext:Button runat="server"
ID="uxPostActivityButton"
Text="Post to Oracle"
Icon="ApplicationGet"
Disabled="true">
</ext:Button>
</Items>
</ext:Toolbar>
</TopBar>
</ext:GridPanel>
<ext:Window runat="server" ID="uxSubmitActivityWindow"
Title="Submit Activity"
Hidden="true"
Width="650"
Shadow="true"
Y="50">
<Loader runat="server"
ID="uxSubmitActivityLoader"
Mode="Frame"
AutoLoad="false" />

<ext:Window runat="server"
ID="uxChoosePerDiemWindow"
Title="Choose Per Diem"
Hidden="true"
Width="650"
Shadow="true"
Y="50">
<Loader runat="server"
ID="uxChoosePerDiemLoader"
Mode="Frame"
AutoLoad="false" />

uxManageExisting.aspx.cs


protected void deSubmitActivity(object sender, DirectEventArgs e)
{
string WindowUrl = string.Format("umSubmitActivity.aspx?headerId={0}", e.ExtraParams["HeaderId"]);


uxSubmitActivityWindow.LoadContent(WindowUrl);
uxSubmitActivityWindow.Show();
}
[DirectMethod]
public void dmLoadPerDiemPicker(string HeaderList)
{
uxChoosePerDiemWindow.Loader.Url = string.Format("umChoosePerDiem.aspx?HeaderList={0}", HeaderList);
uxChoosePerDiemWindow.LoadContent();
uxChoosePerDiemWindow.Show();
uxSubmitActivityWindow.Hide();
}



umSubmitActivity.aspx


<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="umSubmitActivity.aspx.cs" Inherits="DBI.Web.EMS.Views.Modules.DailyActivity.umSubmitAc tivity" %>


<!DOCTYPE html>


<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title></title>
<link href="../../../Resources/StyleSheets/main.css" rel="stylesheet" />
</head>
<body>
<form id="form1" runat="server">
<ext:ResourceManager ID="ResourceManager1" runat="server" IsDynamic="False" />
<ext:Panel runat="server" ID="uxSubmitActivityPanel" Layout="FitLayout">
<Items>
<ext:FormPanel runat="server"
ID="uxSubmitActivityForm"
Layout="FormLayout"
Padding="5">
<Items>
<ext:TextField runat="server"
ID="uxSubmitReasonForNoWork"
AllowBlank="true"
FieldLabel="Reason for no work" />
<ext:TextField runat="server"
ID="uxSubmitHotel"
AllowBlank="true"
FieldLabel="Hotel" />
<ext:TextField runat="server"
ID="uxSubmitCity"
AllowBlank="true"
FieldLabel="City" />
<ext:TextField runat="server"
ID="uxSubmitState"
AllowBlank="true"
FieldLabel="State" />
<ext:TextField runat="server"
ID="uxSubmitPhone"
FieldLabel="Phone #" />
<ext:FileUploadField runat="server"
ID="uxSubmitSignature"
FieldLabel="Foreman Signature" />
<ext:Image runat="server"
ID="uxForemanSignatureImage"
Height="150"
Hidden="true" />
<ext:FileUploadField runat="server"
ID="uxSubmitContract"
FieldLabel="Contract Representative" />
<ext:Image runat="server"
ID="uxContractRepresentativeImage"
Height="150"
Hidden="true" />
</Items>
<Buttons>
<ext:Button runat="server"
ID="uxSaveAndSubmitButton"
Text="Save and Submit"
Icon="DatabaseAdd">
<DirectEvents>
<Click OnEvent="deStoreFooterAndSubmit" />
</DirectEvents>
</ext:Button>
<ext:Button runat="server"
ID="uxSaveOnlyButton"
Text="Save Only"
Icon="DatabaseSave">
<DirectEvents>
<Click OnEvent="deStoreFooter" />
</DirectEvents>
<Listeners>
<Click Handler="parentAutoLoadControl.hide();" />
</Listeners>
</ext:Button>
<ext:Button runat="server"
ID="uxCancelButton"
Text="Cancel"
Icon="DatabaseStop">
<Listeners>
<Click Handler="#{uxSubmitActivityForm}.reset();
parentAutoLoadControl.hide();" />
</Listeners>
</ext:Button>
</Buttons>
</ext:FormPanel>
</Items>
<Listeners>
<AfterRender
Handler="var win = parentAutoLoadControl.target || parentAutoLoadControl, //you can use just 'parentAutoLoadControl' after update to Ext.NET v2 beta.
size = this.getSize();

size.height += 34;
size.width += 12;
win.setSize(size);"
Delay="100" />
</Listeners>
</ext:Panel>
</form>
</body>
</html>


umSubmitActivity.aspx.cs(relevant methods)


protected void deStoreFooterAndSubmit(object sender, DirectEventArgs e)
{
//Set HeaderId
long HeaderId = long.Parse(Request.QueryString["HeaderId"]);


//Store Footer to DB
deStoreFooter(sender, e);


checkPerDiem(HeaderId);
}


protected void checkPerDiem(long HeaderId)
{
using (Entities _context = new Entities())
{
//Get List of Employees for this header with Per-Diem active
var EmployeeList = (from d in _context.DAILY_ACTIVITY_EMPLOYEE
where d.HEADER_ID == HeaderId && d.PER_DIEM == "Y"
select new { d.PERSON_ID, d.DAILY_ACTIVITY_HEADER.DA_DATE }).ToList();

//Check for Additional active PerDiems on that day
foreach (var Employee in EmployeeList)
{
var HeaderList = (from d in _context.DAILY_ACTIVITY_EMPLOYEE
join h in _context.DAILY_ACTIVITY_HEADER on d.HEADER_ID equals h.HEADER_ID
join p in _context.PROJECTS_V on h.PROJECT_ID equals p.PROJECT_ID
where h.DA_DATE == Employee.DA_DATE && d.PERSON_ID == Employee.PERSON_ID
select new HeaderDetails { HEADER_ID = h.HEADER_ID, LONG_NAME = p.LONG_NAME, PERSON_ID = d.PERSON_ID }).ToList();


if (HeaderList.Count > 1)
{
X.Js.Call("parent.App.direct.dmLoadPerDiemPicker(" + Ext.Net.JSON.Serialize(HeaderList) + ")");
}


}
}
}


umChoosePerDiem.aspx.cs


protected void Page_Load(object sender, EventArgs e)
{
FillComboBox(Request.QueryString["HeaderList"]);
}


protected void FillComboBox(string HeaderList)
{
Dictionary<string, string>[] Headers = JSON.Deserialize<Dictionary<string, string>[]>(HeaderList);


List<HeaderDetails> HeaderComboStore = new List<HeaderDetails>();


foreach (Dictionary<string, string> Header in Headers)
{
long HeaderId = long.Parse(Header["HEADER_ID"]);
string LongName = Header["LONG_NAME"].ToString();


HeaderComboStore.Add(new HeaderDetails()
{
HEADER_ID = HeaderId,
LONG_NAME = LongName
});
}
uxChoosePerDiemHeaderIdStore.DataSource = HeaderComboStore;
}

Daniil
Jan 17, 2014, 4:07 AM
Unfortunately, it doesn't help us much to understand the problem.

We would expect something runnable. I mean we should be able to copy, paste and run the sample without any changes and reproduce the problem following some exact steps which you are supposed to provide as well.