Jun 05, 2013, 9:25 AM
[FIXED] [#269] [2.x] how to add window's item from session to another window's item?
my goal is : when click a NumberField , then pop a window which contain the some panel which num is save as the numberfield's Number .
when the numberfield's Number is less then the current panel's number, then remove the redundant num, if the numberfield's Number is more, then
add the panel until the number is same.
thanks.
when the numberfield's Number is less then the current panel's number, then remove the redundant num, if the numberfield's Number is more, then
add the panel until the number is same.
<ext:Window runat="server" Width="320" ID="w_docwin" Hidden="True" Modal="True" Title="附件管ç†" Layout="AccordionLayout">
</ext:Window>
<ext:NumberField Icon="TextListNumbers" ID="nf_doc" runat="server" InputWidth="60" EmptyText="0">
<DirectEvents>
<IconClick OnEvent="e_doclick">
<ExtraParams>
<ext:Parameter Name="count" Value="#{w_docwin}.items.getCount()" Mode="Raw"/>
</ExtraParams>
</IconClick>
</DirectEvents>
</ext:NumberField>
protected void e_doclick(object sender, DirectEventArgs e)
{
if (nf_doc.Value != null)
{
var n = (int)nf_doc.Number;//设置的数目
int c =int.Parse(e.ExtraParams["count"].ToString());//先有的数目
if (n > c)//if is more than current panel's number in the window
{
for (int i = 0; i < n-c; i++)
{
var p = new Ext.Net.Panel();
var tf = new TextField { FieldLabel = "附件å称" };
var tf1 = new TextField { FieldLabel = "附件æè¿°" };
var tf2 = new TextField { FieldLabel = "其他æè¿°" };
var upload = new FileUploadField { FieldLabel = "文件", ButtonText = "æµè§ˆ" };
p.Items.Add(tf);
p.Items.Add(tf1);
p.Items.Add(tf2);
p.Items.Add(upload);
w_docwin.Items.Add(p);
p.Render();
}
} else if (n < c)//if is less than the current panel's number in the winow.
{
Window attaWindow = (Window)Session["pz_atta"];//get window from store.
for (int i = n; i < c; i++)
{
attaWindow.Items.RemoveAt(n);//remove the redundant panel.
}
w_docwin.Items.Clear(); //?
w_docwin.Items.AddRange(attaWindow.Items);//? here how to add the attaWindow's items to the window w_docwin?
}
Session["pz_atta"] = w_docwin; //use session to store window.
w_docwin.Show();
}
how to do ?thanks.
Last edited by fabricio.murta; Apr 27, 2016 at 12:36 AM.