i have a code which accepts multiple file on gridview but when clickd on save it is taking only 1 file
- protected void btnUpload_Click(object sender, EventArgs e)
- {
- try
- {
- ddlBillType_DataBound(ddlBillType, e);
-
-
- DataTable dtDoc = new DataTable();
-
-
- if (dtDoc.Rows.Count < 0)
- {
-
-
- dtDoc = objTrnFVCBillAction.GetBlankDocumentListDataTable();
- ViewState["dtAddDoc"] = dtDoc;
- lblAutoDocID.Text = "0";
-
- }
- else
- {
- dtDoc = (DataTable)ViewState["dtAddDoc"];
-
- }
-
-
- if (ddlDocumentName.SelectedValue != "0" && fuSupDocs.FileName != "")
- {
- DataRow dr = dtDoc.NewRow();
-
-
- btnUpload.EnableViewState = true;
-
- if (btnUpload.Text == "Add Document")
- {
- if (lblAutoDocID.Text == "")
- {
- lblAutoDocID.Text = "0";
- }
-
- lblAutoDocID.Text = (long.Parse(lblAutoDocID.Text) + 1).ToString();
-
- dr[Constant.Auto_Gen_ID] = long.Parse(lblAutoDocID.Text);
- }
- dr["Document_Name"] = ddlDocumentName.SelectedItem.Text;
-
- if (fuSupDocs.HasFile)
- {
-
- dr["Document_Name"] = fuSupDocs.PostedFile.FileName;
-
- string sFileName = string.Empty;
-
-
- sFileName = Server.MapPath(@"~/Temp/" + fuSupDocs.FileName);
- fuSupDocs.SaveAs(sFileName);
-
- dr["Document_URL"] = sFileName;
-
- }
- if (btnUpload.Text == "Add Document")
- {
-
- dtDoc.Rows.Add(dr);
- ViewState["dtAddDoc"] = dtDoc;
-
- grdSuppDocs.DataSource = dtDoc;
- grdSuppDocs.DataBind();
- BlankDoc();
- }
- }
- }
- catch (Exception ex)
- {
- Omb.ShowMessage(ex.Message, true);
- }
- }
action page code
- public DataTable GetBlankDocumentListDataTable()
- {
- DataTable dtDocVoucher = new DataTable();
- dtDocVoucher.Columns.Add(Constant.Auto_Gen_ID, System.Type.GetType("System.Int64"));
- dtDocVoucher.Columns.Add("Document_Name", Type.GetType("System.String"));
- dtDocVoucher.Columns.Add("Document_URL", Type.GetType("System.String"));
-
- return dtDocVoucher;
- }