protected void grdLfsM2_RowUpdating(object sender, GridViewUpdateEventArgs e)
        {
            Page.Validate("dataEdit");
            if (Page.IsValid)
            {
                Guid id = new Guid(((Label)grdLfsM2.Rows[e.RowIndex].Cells[0].FindControl("lblId")).Text);
                int refId = Int32.Parse(((Label)grdLfsM2.Rows[e.RowIndex].Cells[1].FindControl("lblRefId")).Text);
                int companyId = Int32.Parse(((Label)grdLfsM2.Rows[e.RowIndex].Cells[2].FindControl("lblCOMPANY_ID")).Text);

                float? videoDistance = null; if (((TextBox)grdLfsM2.Rows[e.RowIndex].Cells[3].FindControl("tbxVideoDistanceEdit")).Text.Trim() != "") videoDistance = float.Parse(((TextBox)grdLfsM2.Rows[e.RowIndex].Cells[3].FindControl("tbxVideoDistanceEdit")).Text.Trim());
                string clockPosition = ""; if (((TextBox)grdLfsM2.Rows[e.RowIndex].Cells[3].FindControl("tbxClockPositionEdit")).Text.Trim() != "") clockPosition = ((TextBox)grdLfsM2.Rows[e.RowIndex].Cells[3].FindControl("tbxClockPositionEdit")).Text.Trim();
                string liveOrAbandoned = ""; if (((TextBox)grdLfsM2.Rows[e.RowIndex].Cells[3].FindControl("tbxLiveOrAbandonedEdit")).Text.Trim() != "") liveOrAbandoned = ((TextBox)grdLfsM2.Rows[e.RowIndex].Cells[3].FindControl("tbxLiveOrAbandonedEdit")).Text.Trim();
                string distanceToCentreOfLateral = ""; if (((TextBox)grdLfsM2.Rows[e.RowIndex].Cells[3].FindControl("tbxDistanceToCentreEdit")).Text.Trim() != "") distanceToCentreOfLateral = ((TextBox)grdLfsM2.Rows[e.RowIndex].Cells[3].FindControl("tbxDistanceToCentreEdit")).Text.Trim();
                string lateralDiameter = ""; if (((TextBox)grdLfsM2.Rows[e.RowIndex].Cells[3].FindControl("tbxLateralDiameterEdit")).Text.Trim() != "") lateralDiameter = ((TextBox)grdLfsM2.Rows[e.RowIndex].Cells[3].FindControl("tbxLateralDiameterEdit")).Text.Trim();
                string lateralType = ""; if (((TextBox)grdLfsM2.Rows[e.RowIndex].Cells[3].FindControl("tbxLateralTypeEdit")).Text.Trim() != "") lateralType = ((TextBox)grdLfsM2.Rows[e.RowIndex].Cells[3].FindControl("tbxLateralTypeEdit")).Text.Trim();
                string dateTimeOpened = ""; if (((TextBox)grdLfsM2.Rows[e.RowIndex].Cells[3].FindControl("tbxTimeOpenedEdit")).Text.Trim() != "") dateTimeOpened = ((TextBox)grdLfsM2.Rows[e.RowIndex].Cells[3].FindControl("tbxTimeOpenedEdit")).Text.Trim();
                string comments = ""; if (((TextBox)grdLfsM2.Rows[e.RowIndex].Cells[3].FindControl("tbxCommentEdit")).Text.Trim() != "") comments = ((TextBox)grdLfsM2.Rows[e.RowIndex].Cells[3].FindControl("tbxCommentEdit")).Text.Trim();
                string reverseSetup = "";
                if (distanceToCentreOfLateral != "")
                {
                    TDSLFSRecord.LFS_MASTER_AREARow lfsMasterAreaRow = tdsLfsRecord.LFS_MASTER_AREA.FindByIDCOMPANY_ID(new Guid(tbxID.Text), Convert.ToInt32(Session["companyID"]));
                    reverseSetup = Distance.Subtract(lfsMasterAreaRow.IsActualLengthNull() ? "" : lfsMasterAreaRow.ActualLength, distanceToCentreOfLateral);
                }

                ViewFullLengthLiningLfsM2Tables model = new ViewFullLengthLiningLfsM2Tables(viewFullLengthLiningTDS);
                model.Update(id, refId, companyId, videoDistance, clockPosition, liveOrAbandoned, distanceToCentreOfLateral, lateralDiameter, lateralType, dateTimeOpened, comments, reverseSetup);

                Session["viewFullLengthLiningTDS"] = viewFullLengthLiningTDS;
            }
            else
            {
                e.Cancel = true;
            }
        }