Riddhi Valecha

Riddhi Valecha

  • 583
  • 2.7k
  • 236.6k

Multiple File Upload in Gridview for each row

Nov 17 2016 9:47 AM
Dear all,
 
My Requirement is - 
I have to upload multiple files for each row in GridView.
 
I have taken reference from -
http://www.aspsnippets.com/Articles/Implement-Uploadify-jQuery-Plugin-in-ASPNet.aspx
 
My aspx page is -
<head runat="server">

<link href="App_Themes/JQuery_MultipleFilesUploadAndDownload/uploadify.css" rel="stylesheet" />
</head>
<body>
<script type="text/javascript" src="App_Themes/JQuery_MultipleFilesUploadAndDownload/jquery-1.3.2.min.js"></script>
<script type="text/javascript" src="App_Themes/JQuery_MultipleFilesUploadAndDownload/jquery.uploadify.js"></script>
<form id="form1" runat="server"> <div align="center">
<table border="0" cellpadding="0", cellspacing="2">
<tr>
<td><strong>File Upload</strong></td>
<td>
<asp:GridView ID="grdData" runat="server" OnRowCreated="grdUpdateAssetStatus_RowCreated" >
<Columns>
<asp:TemplateField>
<ItemTemplate>
<asp:FileUpload ID="fileupload1" runat="server"/>
<script type = "text/javascript">
$(window).load(
function () {
$("[id*=fileupload1]").fileUpload({
'uploader': 'App_Themes/JQuery_MultipleFilesUploadAndDownload/uploader.swf',
'cancelImg': 'App_Themes/JQuery_MultipleFilesUploadAndDownload/cancel.png',
'buttonText': 'Browse Files',
'script': 'UpdateAssetStatusFileUploadHandler.ashx',
'folder': 'uploads',
'fileDesc': 'Image Files',
'fileExt': '*.jpg;*.jpeg;*.gif;*.png',
'multi': true,
'auto': true
});} );
</script>
</ItemTemplate>
</asp:TemplateField>
</Columns>
<HeaderStyle Height="50px" BackColor=" #000066" ForeColor="White" />
</asp:GridView>
</td>
</tr>
</table>
</div>
</form>
</body>
-----
Issue-
Line - $("[id*=fileupload1]").fileUpload({
$("[id*=fileupload1]").fileUpload({ - Output - 3 Browser Buttons
$("#<%=fileupload1.ClientID %>").fileUpload({ - Error - The element does not exist in the current context 
--------
Please correct me where I am going wrong.

Answers (5)