protected void grdComments_RowUpdating(object sender, GridViewUpdateEventArgs e) { Page.Validate("commentsDataEdit"); if (Page.IsValid) { int workId = (int)e.Keys["WorkID"]; int refId = (int)e.Keys["RefID"]; int companyId = Int32.Parse(hdfCompanyId.Value); int loginId = Convert.ToInt32(Session["loginID"]); bool adminPermission = Convert.ToBoolean(Session["sgLFS_CWP_JUNCTIONLINING_ADMIN"]); string type = ((Label)grdComments.Rows[e.RowIndex].Cells[4].FindControl("lblType")).Text.Trim(); string newSubject = ((TextBox)grdComments.Rows[e.RowIndex].Cells[5].FindControl("tbxSubjectEdit")).Text.Trim(); string newComment = ((TextBox)grdComments.Rows[e.RowIndex].Cells[5].FindControl("tbxCommentsEdit")).Text.Trim(); bool toHistory = ((CheckBox)grdComments.Rows[e.RowIndex].Cells[5].FindControl("ckbxToHistoryEdit")).Checked; // Update data FlatSectionJlCommentDetails model = new FlatSectionJlCommentDetails(flatSectionJlTDS); model.Update(workId, refId, type, newSubject, companyId, newComment, loginId, adminPermission, toHistory); // Store dataset Session["flatSectionJlTDS"] = flatSectionJlTDS; Session["flatSectionJlCommentDetails"] = flatSectionJlTDS.FlatSectionJlCommentDetails; } else { e.Cancel = true; } }