protected void gvContract_RowUpdating(object sender, GridViewUpdateEventArgs e) { DateTime startDate = Convert.ToDateTime(gvContract.DataKeys[e.RowIndex].Value.ToString()); DateTime endDate = Convert.ToDateTime(gvContract.DataKeys[e.RowIndex].Value.ToString()); decimal amount = Convert.ToDecimal(gvContract.DataKeys[e.RowIndex].Value.ToString()); Label txtContractID = (Label)gvContract.Rows[e.RowIndex].FindControl("txtContractID"); TextBox txtEmpName = (TextBox)gvContract.Rows[e.RowIndex].FindControl("txtEmpName"); TextBox txtStartDate = (TextBox)gvContract.Rows[e.RowIndex].FindControl("txtStartDate"); TextBox txtEndDate = (TextBox)gvContract.Rows[e.RowIndex].FindControl("txtEndDate"); TextBox txtAmount = (TextBox)gvContract.Rows[e.RowIndex].FindControl("txtAmount"); TextBox txtVendorBrn = (TextBox)gvContract.Rows[e.RowIndex].FindControl("txtVendorBrn"); TextBox txtName = (TextBox)gvContract.Rows[e.RowIndex].FindControl("txtName "); TextBox txtProducts = (TextBox)gvContract.Rows[e.RowIndex].FindControl("txtProducts "); TextBox txtRef = (TextBox)gvContract.Rows[e.RowIndex].FindControl("txtRef"); TextBox txtProj = (TextBox)gvContract.Rows[e.RowIndex].FindControl("txtPro "); TextBox txtAlert = (TextBox)gvContract.Rows[e.RowIndex].FindControl("txtAlert"); TextBox txtTemplateID = (TextBox)gvContract.Rows[e.RowIndex].FindControl("txtTemplateID "); vrmdb.Update_ContractRecords(txtContractID.Text, txtEmpName.Text,txtStartDate.Text, txtEndDate.Text, txtAmount.Text,txtVendorBrn.Text,txtName.Text,txtProducts.Text,txtRef.Text, txtProj.Text,txtAlert.Text,txtTemplateID.Text); gvContract.EditIndex = -1; BindGrid(true); Response.Redirect("ContractManagement.aspx"); } } }