Hi All ,
I am using ajaxfileupload for multiple files and i want to save the count of each files uplaod.
Suppose file 1 upload count =1
file 2 Count =2 upto 5 files i have set limit.
I need to save the file count in every excel. Suppose one excel upload
In database there will be FileCount Column and for excel 1, 1 should saved.
<asp:AjaxFileUpload ID="AjaxFileUploadAdvanceAdjusted" runat="server" Width="850px" AllowedFileTypes="xlsx,xls" MaxFileSize="10000" MaximumNumberOfFiles="5" OnUploadComplete="AjaxFileUpload_UploadComplete" />
protected void AjaxFileUpload1_UploadComplete(object sender, AjaxFileUploadEventArgs e)
{
dt2 = new DataTable();
try
{
string filename = Path.GetFileName(e.FileName);
string FolderPath = "~/MyFiles/Files/";
string filepath = Server.MapPath(FolderPath + filename);
AjaxFileUploadOutward.SaveAs(filepath);
//To set dafault coloumn in datatable and save in datatabase.
dtExcelData.Columns.Add("Cell").DefaultValue.ToString();
dtExcelData.Columns.Add("FileCount1").DefaultValue.ToString();
//Foreach to add in every row in datatable.
foreach (DataRow row in dtExcelData.Rows)
{
row["Cell"] = Session["ClientName"].ToString();
row["FileCount1"] = ???
}
dtExcelData.Columns["Cell"].SetOrdinal(0);
dtExcelData.Columns["FileCount1"].SetOrdinal(1);
//Bulkinsert method to insert data in sql.
InsDataInSql("File1", "abcFile1");
}
}
Please help.