protected void GridView1_RowUpdating(object sender, GridViewUpdateEventArgs e) { string path = ""; if (fileupload_attachment.HasFile) { path = Server.MapPath("attachments"); if (!Directory.Exists(path)) { Directory.CreateDirectory(path); } string file_name = fileupload_attachment.FileName.ToString(); path += "\\" + file_name; fileupload_attachment.SaveAs(path); path = "\\attachments\\" + file_name; } string date = Convert.ToDateTime(textBox_calendar.Text).ToString("yyyy-MM-dd").ToString().Trim(); eb.updateExpense(hf1.Value, date, dropdown_category.SelectedValue, textArea_description.Text, textBox_amount.Text, textBox_paidBy.Text, path); clearAll(); GridView1.EditIndex = -1; bindGrid(); insert_button.Visible = true; excel_button.Visible = true; generatelist_button.Visible = true; }