protected void gvTemplate_RowCommand(object sender, GridViewCommandEventArgs e) { if (e.CommandName.Equals("AddNew")) { TextBox txtTemplateID = (TextBox)gvTemplate.FooterRow.FindControl("txtTemplateID"); TextBox txtTemplateName = (TextBox)gvTemplate.FooterRow.FindControl("txtTemplateName"); TextBox txtFileName = (TextBox)gvTemplate.FooterRow.FindControl("txtFileName"); FileUpload txtFilePath = (FileUpload)gvTemplate.FooterRow.FindControl("txtFilePath"); vrmdb.Insert_TemplateRecords(txtTemplateID.Text, txtTemplateName.Text, txtFileName.Text, txtFilePath.FileName); txtFilePath.SaveAs(Server.MapPath("~/Upload/") + txtFilePath.FileName); BindGrid(true); Response.Redirect("ContractTemplate.aspx"); }