May 21, 2012, 3:19 PM
[CLOSED] Need a remove button for a dynamically created FileUpload control
Hi,
I wish to place an "Add" and "Remove" button alongside each FileUpload control that is added dynamically. Clicking on "Add" will create a new FileUpload control below the current one. Clicking on "Remove" will remove the current "FileUpload control.
This sample code below has the "Add" button but does not seem to be able to create a new FileUpload control when clicked on.
Could you please help?
Ravi Swaminathan
I wish to place an "Add" and "Remove" button alongside each FileUpload control that is added dynamically. Clicking on "Add" will create a new FileUpload control below the current one. Clicking on "Remove" will remove the current "FileUpload control.
This sample code below has the "Add" button but does not seem to be able to create a new FileUpload control when clicked on.
Could you please help?
<%@ Page Language="vb" AutoEventWireup="false" CodeBehind="FileUpload.aspx.vb" Inherits="EXTTabs.FileUpload" %>
<%@ 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>Ext.Net Example</title>
<script type="text/javascript">
var count = 1;
var addField = function (form) {
count++;
form.add(new Ext.form.DisplayField({
anchor: "100%",
height: 10
}));
form.addAndDoLayout(new Ext.form.FileUploadField({
width: "300",
}));
}
</script>
</head>
<body>
<form id="Form1" runat="server" enctype="multipart/form-data" method="post">
<ext:ResourceManager ID="ResourceManager1" runat="server" />
<ext:FormPanel ID="FormPanel1" Layout="HBoxLayout" runat="server" Width="500" Padding="20"
AutoHeight="true">
<Items>
<ext:FileUploadField ID="FileUploadField1" runat="server" Width="300">
<DirectEvents>
<FileSelected OnEvent="FileUploadField_FileSelected" IsUpload="False" />
</DirectEvents>
</ext:FileUploadField>
<ext:Button ID="btnAddFileUpload" runat="server" Text="Add">
<Listeners>
<Click Handler="addField(FormPanel1)" />
</Listeners>
</ext:Button>
</Items>
</ext:FormPanel>
<ext:Button ID="btnUpload" runat="server" Text="UpLoad">
<DirectEvents>
<Click OnEvent="Upload">
</Click>
</DirectEvents>
</ext:Button>
</form>
</body>
</html>
ThanksRavi Swaminathan
Last edited by Daniil; May 22, 2012 at 1:52 PM.
Reason: [CLOSED]