Jun 09, 2013, 1:47 AM
[CLOSED] how to batch upload ?
I create a modal window which contains several panels in codebehind , each panel have 3 textfields and a upload control.
a button in the page, when click the button , how to get the textfields 's value and upload the upload control's file in codebehind.
below is my example code:
a button in the page, when click the button , how to get the textfields 's value and upload the upload control's file in codebehind.
below is my example code:
<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="WebForm1.aspx.cs" Inherits="TobrosCWT.pages.pingzheng.WebForm1" %>
<script runat="server">
private Ext.Net.Panel GetPanel(int index)
{
return new Ext.Net.Panel()
{
Title = "附件" + index,
Items =
{
new TextField() { FieldLabel = "附件名称" },
new TextField() { FieldLabel = "附件描述" },
new TextField() { FieldLabel = "其他描述" },
new FileUploadField(){FieldLabel="附件",Icon=Ext.Net.Icon.ImageAdd,ButtonText=""}
}
};
}
protected void e_upload(object sender, DirectEventArgs e)
{
// X.Msg.Alert("ssss", "dddd").Show();
//here, how to get Window1's items which Dynamic Created by NumberField1_IconClick.
// and loop the items,get three textfields'value and upload the fileuploadfield in each loop.
// can you give me an example code?
}
protected void NumberField1_IconClick(object sender, DirectEventArgs e)
{
int currentCount = int.Parse(e.ExtraParams["currentCount"]);
int neededCount = (int)this.NumberField1.Number;
int panelsToAdd = neededCount - currentCount;
if (panelsToAdd > 0)
{
for (int i = 1; i <= panelsToAdd; i++)
{
this.GetPanel(i + currentCount).AddTo(this.Window1);
}
}
else if (panelsToAdd < 0)
{
X.Js.Call("removeFrom", this.Window1.ConfigID, -panelsToAdd, currentCount);
}
this.Window1.Show();
}
</script>
<!DOCTYPE html>
<html>
<head id="Head1" runat="server">
<title>Ext.NET v2 Example</title>
<script type="text/javascript">
var removeFrom = function (win, countToRemove, totalCount) {
win = App[win];
var items = win.items;
Ext.suspendLayouts();
for (var i = 1; i <= countToRemove; i++) {
win.remove(items.getAt(totalCount - i));
}
Ext.resumeLayouts(true);
if (win.items.length > 0)
win.items.first().getBody().el.setVisible(true);
};
</script>
</head>
<body>
<form id="Form1" runat="server">
<ext:ResourceManager ID="ResourceManager1" runat="server" />
<ext:Viewport runat="server" Layout="TableLayout">
<Items>
<ext:Window
ID="Window1"
runat="server"
Width="300"
Height="300"
Hidden="true"
Layout="AccordionLayout" />
<ext:NumberField ID="NumberField1" runat="server" Icon="Add">
<DirectEvents>
<IconClick OnEvent="NumberField1_IconClick">
<ExtraParams>
<ext:Parameter Name="currentCount" Value="App.Window1.items.getCount()" Mode="Raw" />
</ExtraParams>
</IconClick>
</DirectEvents>
</ext:NumberField>
<ext:Button ID="Button1" runat="server" Text="upload">
<DirectEvents>
<Click OnEvent="e_upload"></Click>
</DirectEvents>
</ext:Button>
</Items>
</ext:Viewport>
</form>
</body>
</html>
Last edited by Daniil; Jun 18, 2013 at 3:51 AM.
Reason: [CLOSED]