// ////////////////////////////////////////////////////////////////////////
        // EVENTS
        //
        protected void Page_Load(object sender, EventArgs e)
        {
            // Register client scripts
            this.RegisterClientScripts();

            if (!IsPostBack)
            {
                // Security check
                if (!(Convert.ToBoolean(Session["sgLFS_CWP_MANHOLEREHABILITATION_VIEW"])))
                {
                    Response.Redirect("./../../error_page.aspx?error=" + "You are not authorized to view this page. Contact your system administrator.");
                }

                // Validate query string
                if (((string)Request.QueryString["source_page"] == null) || ((string)Request.QueryString["client_id"] == null) || ((string)Request.QueryString["project_id"] == null) || ((string)Request.QueryString["in_project"] == null))
                {
                    Response.Redirect("./../../error_page.aspx?error=" + "Invalid query string in mr_navigator2.aspx");
                }

                // Tag Page
                hdfCompanyId.Value = Session["companyID"].ToString();
                hdfCurrentProjectId.Value = Request.QueryString["project_id"].ToString();
                hdfCurrentClientId.Value = Request.QueryString["client_id"].ToString();
                hdfInProject.Value = Request.QueryString["in_project"].ToString();
                hdfWorkType.Value = "Manhole Rehabilitation";

                // Prepare initial data
                // ... For sortByList
                odsSortByList.DataBind();
                ddlSortBy.DataSourceID = "odsSortByList";
                ddlSortBy.DataValueField = "SortID";
                ddlSortBy.DataTextField = "Name";
                ddlSortBy.DataBind();

                // ... For
                odsViewForDisplayList.DataBind();
                ddlCondition1.DataSourceID = "odsViewForDisplayList";
                ddlCondition1.DataValueField = "ConditionID";
                ddlCondition1.DataTextField = "Name";
                ddlCondition1.DataBind();

                // ... For view ddl
                int companyId = Int32.Parse(hdfCompanyId.Value.Trim());
                string workType = hdfWorkType.Value;
                int loginId = Convert.ToInt32(Session["loginID"]);
                string viewTypeGlobal = "";
                string viewTypePersonal = "Personal";

                // Global Views check
                if (Convert.ToBoolean(Session["sgLFS_GLOBALVIEWS_VIEW"]))
                {
                    viewTypeGlobal = "Global";
                }

                WorkViewList workViewList = new WorkViewList();
                workViewList.LoadAndAddItem(workType, viewTypeGlobal, viewTypePersonal, loginId, companyId);
                ddlView.DataSource = workViewList.Table;
                ddlView.DataValueField = "ViewID";
                ddlView.DataTextField = "Name";
                ddlView.DataBind();
                ddlView.SelectedIndex = 1;

                // Validate top information
                if ((hdfCurrentClientId.Value != "0") && (hdfCurrentProjectId.Value != "0"))
                {
                    // ... for client
                    int currentClientId = Int32.Parse(hdfCurrentClientId.Value.ToString());

                    CompaniesGateway companiesGateway = new CompaniesGateway();
                    companiesGateway.LoadByCompaniesId(currentClientId, companyId);
                    lblTitleClientName.Text = "Client: " + companiesGateway.GetName(currentClientId);

                    // ... for project
                    int currentProjectId = Int32.Parse(hdfCurrentProjectId.Value.ToString());
                    ProjectGateway projectGateway = new ProjectGateway();
                    projectGateway.LoadByProjectId(currentProjectId);
                    string name = projectGateway.GetName(currentProjectId);
                    if (name.Length > 23) name = name.Substring(0, 20) + "...";
                    lblTitleProjectName.Text = " > Project: " + name + " (" + projectGateway.GetProjectNumber(currentProjectId) + ")";
                }
                else
                {
                    lblTitleClientName.Text = "";
                    lblTitleProjectName.Text = "";
                }

                // If coming from
                // ... mr_navigator.aspx or mr_navigator2.aspx
                if ((Request.QueryString["source_page"] == "mr_navigator.aspx") || (Request.QueryString["source_page"] == "mr_navigator2.aspx"))
                {
                    RestoreNavigatorState();

                    mrNavigatorTDS = (MrNavigatorTDS)Session["mrNavigatorTDS"];
                }

                // ... mr_edit.aspx, mr_summary.aspx or mr_delete.aspx
                if ((Request.QueryString["source_page"] == "mr_edit.aspx") || (Request.QueryString["source_page"] == "mr_summary.aspx") || (Request.QueryString["source_page"] == "mr_delete.aspx"))
                {
                    RestoreNavigatorState();

                    if (Request.QueryString["update"] == "no")
                    {
                        mrNavigatorTDS = (MrNavigatorTDS)Session["mrNavigatorTDS"];
                    }
                    else
                    {
                        // ... Delete store data
                        Session.Contents.Remove("mrNavigatorTDS");

                        // ... Search data with updates
                        if (hdfBtnOrigin.Value == "Search")
                        {
                            mrNavigatorTDS = SubmitSearch();
                        }
                        else
                        {
                            if (hdfBtnOrigin.Value == "Go")
                            {
                                mrNavigatorTDS = SubmitSearchForViews();
                            }
                        }

                        // ... store datasets
                        Session["mrNavigatorTDS"] = mrNavigatorTDS;
                    }
                }

                // ... mr_delete.aspx, mr_summary.aspx or mr_edit.aspx
                if ((Request.QueryString["source_page"] == "mr_delete.aspx") || (Request.QueryString["source_page"] == "mr_summary.aspx") || (Request.QueryString["source_page"] == "mr_edit.aspx"))
                {
                    if (mrNavigatorTDS.MrNavigator.Rows.Count == 0)
                    {
                        string url = "./mr_navigator.aspx?source_page=mr_navigator2.aspx&client_id=" + hdfCurrentClientId.Value + "&project_id=" + hdfCurrentProjectId.Value + "&work_type=" + hdfWorkType.Value + "&in_project=" + hdfInProject.Value + GetNavigatorState() + "&no_results=yes";
                        Response.Redirect(url);
                    }
                }

                // For the grid
                grdMRNavigator.DataSource = mrNavigatorTDS.MrNavigator;
                grdMRNavigator.DataBind();

                //... for the total rows
                if (mrNavigatorTDS.MrNavigator.Rows.Count > 0)
                {
                    lblTotalRows.Text = "Total Rows: " + mrNavigatorTDS.MrNavigator.Rows.Count;
                    lblTotalRows.Visible = true;
                }
                else
                {
                    lblTotalRows.Visible = false;
                }
            }
            else
            {
                // Restore TDS
                mrNavigatorTDS = (MrNavigatorTDS)Session["mrNavigatorTDS"];

                // ... for the total rows
                if (mrNavigatorTDS.MrNavigator.Rows.Count > 0)
                {
                    lblTotalRows.Text = "Total Rows: " + mrNavigatorTDS.MrNavigator.Rows.Count;
                    lblTotalRows.Visible = true;
                }
                else
                {
                    lblTotalRows.Visible = false;
                }
            }
        }
        private void RestoreNavigatorState()
        {
            // Columns To Display
            string columnsToDisplay = Request.QueryString["columns_to_display"];
            string columnsToDisplay2 = Request.QueryString["columns_to_display2"];

            // Search condition
            // ... For Condition 1
            odsViewForDisplayList.DataBind();
            ddlCondition1.DataSourceID = "odsViewForDisplayList";
            ddlCondition1.DataValueField = "ConditionID";
            ddlCondition1.DataTextField = "Name";
            ddlCondition1.DataBind();
            ddlCondition1.SelectedValue = Request.QueryString["search_ddlCondition1"];
            tbxCondition1.Text = Request.QueryString["search_tbxCondition1"];
            ddlOperator1.SelectedValue = Request.QueryString["search_ddlOperator1"];

            // ... For Condition 2
            odsViewForDisplayList2.DataBind();
            ddlCondition2.DataSourceID = "odsViewForDisplayList2";
            ddlCondition2.DataValueField = "ConditionID";
            ddlCondition2.DataTextField = "Name";
            ddlCondition2.DataBind();
            ddlCondition2.SelectedValue = Request.QueryString["search_ddlCondition2"];
            tbxCondition2.Text = Request.QueryString["search_tbxCondition2"];
            ddlOperator2.SelectedValue = Request.QueryString["search_ddlOperator2"];

            // ... ForView
            int companyId = Int32.Parse(hdfCompanyId.Value.Trim());
            string workType = hdfWorkType.Value;
            int loginId = Convert.ToInt32(Session["loginID"]);
            string viewTypeGlobal = "";
            string viewTypePersonal = "Personal";

            // Global Views check
            if (Convert.ToBoolean(Session["sgLFS_GLOBALVIEWS_VIEW"]))
            {
                viewTypeGlobal = "Global";
            }

            WorkViewList workViewList = new WorkViewList();
            workViewList.LoadAndAddItem(workType, viewTypeGlobal, viewTypePersonal, loginId, companyId);
            ddlView.DataSource = workViewList.Table;
            ddlView.DataValueField = "ViewID";
            ddlView.DataTextField = "Name";
            ddlView.DataBind();
            ddlView.SelectedValue = Request.QueryString["search_ddlView"];

            //Other values
            //... For SortBy
            odsSortByList.DataBind();
            ddlSortBy.DataSourceID = "odsSortByList";
            ddlSortBy.DataValueField = "SortID";
            ddlSortBy.DataTextField = "Name";
            ddlSortBy.DataBind();
            ddlSortBy.SelectedValue = Request.QueryString["search_sort_by"];

            // ... For BtnOrigin
            hdfBtnOrigin.Value = Request.QueryString["btn_origin"];

            cbxIdManhole.Checked = (columnsToDisplay2.IndexOf("MHID") >= 0 ? true : false);
            cbxStreet.Checked = (columnsToDisplay2.IndexOf("Address") >= 0 ? true : false);
            cbxLatitude.Checked = (columnsToDisplay2.IndexOf("Latitud") >= 0 ? true : false);
            cbxLongitude.Checked = (columnsToDisplay2.IndexOf("Longitude") >= 0 ? true : false);
            cbxShape.Checked = (columnsToDisplay2.IndexOf("ManholeShape") >= 0 ? true : false);
            cbxLocation.Checked = (columnsToDisplay2.IndexOf("Location") >= 0 ? true : false);
            cbxConditionRaiting.Checked = (columnsToDisplay2.IndexOf("ConditionRating") >= 0 ? true : false);
            cbxPreppedDate.Checked = (columnsToDisplay2.IndexOf("PreppedDate") >= 0 ? true : false);
            cbxSprayedDate.Checked = (columnsToDisplay2.IndexOf("SprayedDate") >= 0 ? true : false);
            cbxBatchDate.Checked = (columnsToDisplay2.IndexOf("Date") >= 0 ? true : false);
            cbxComments.Checked = (columnsToDisplay2.IndexOf("Comments") >= 0 ? true : false);

            // Grid's columns
            grdMRNavigator.Columns[1].Visible = (columnsToDisplay.IndexOf("MHID") >= 0 ? true : false);
            grdMRNavigator.Columns[2].Visible = (columnsToDisplay.IndexOf("Address") >= 0 ? true : false);
            grdMRNavigator.Columns[3].Visible = (columnsToDisplay.Contains("Latitud") ? true : false);
            grdMRNavigator.Columns[4].Visible = (columnsToDisplay.IndexOf("Longitude") >= 0 ? true : false);
            grdMRNavigator.Columns[5].Visible = (columnsToDisplay.Contains("ManholeShape") ? true : false);
            grdMRNavigator.Columns[6].Visible = (columnsToDisplay.IndexOf("Location") >= 0 ? true : false);
            grdMRNavigator.Columns[7].Visible = (columnsToDisplay.IndexOf("ConditionRating") >= 0 ? true : false);
            grdMRNavigator.Columns[8].Visible = (columnsToDisplay.IndexOf("PreppedDate") >= 0 ? true : false);
            grdMRNavigator.Columns[9].Visible = (columnsToDisplay.IndexOf("SprayedDate") >= 0 ? true : false);
            grdMRNavigator.Columns[10].Visible = (columnsToDisplay.IndexOf("Date") >= 0 ? true : false);
            grdMRNavigator.Columns[11].Visible = (columnsToDisplay.IndexOf("Comments") >= 0 ? true : false);
        }
        protected void btnViewDelete_Click(object sender, EventArgs e)
        {
            int viewId = Int32.Parse(ddlView.SelectedValue.Trim());
            int companyId = Int32.Parse(hdfCompanyId.Value.Trim());

            if (!Convert.ToBoolean(Session["sgLFS_GLOBALVIEWS_DELETE"]))
            {
                WorkViewGateway workViewGateway = new WorkViewGateway();
                workViewGateway.LoadByViewId(viewId, companyId);
                string viewType = workViewGateway.GetType(viewId);

                if (viewType == "Global")
                {
                    Response.Redirect("./../../error_page.aspx?error=" + "You are not authorized to view this page. Contact your system administrator.");
                }
            }

            UpdateDatabaseForViews();

            // ... For view ddl
            string workType = hdfWorkType.Value;
            int loginId = Convert.ToInt32(Session["loginID"]);
            string viewTypeGlobal = "";
            string viewTypePersonal = "Personal";

            // Global Views check
            if (Convert.ToBoolean(Session["sgLFS_GLOBALVIEWS_VIEW"]))
            {
                viewTypeGlobal = "Global";
            }

            WorkViewList workViewList = new WorkViewList();
            workViewList.LoadAndAddItem(workType, viewTypeGlobal, viewTypePersonal, loginId, companyId);
            ddlView.DataSource = workViewList.Table;
            ddlView.DataValueField = "ViewID";
            ddlView.DataTextField = "Name";
            ddlView.DataBind();
            ddlView.SelectedIndex = 1;
        }
        // ////////////////////////////////////////////////////////////////////////
        // EVENTS
        //
        protected void Page_Load(object sender, EventArgs e)
        {
            // Register client scripts
            this.RegisterClientScripts();

            if (!IsPostBack)
            {
                // Security check
                if (!(Convert.ToBoolean(Session["sgLFS_CWP_JUNCTIONLINING_VIEW"])))
                {
                    Response.Redirect("./../../error_page.aspx?error=" + "You are not authorized to view this page. Contact your system administrator.");
                }

                // Validate query string
                if (((string)Request.QueryString["source_page"] == null) || ((string)Request.QueryString["client_id"] == null) || ((string)Request.QueryString["project_id"] == null) || ((string)Request.QueryString["work_type"] == null))
                {
                    Response.Redirect("./../../error_page.aspx?error=" + "Invalid query string in jl_navigator.aspx");
                }

                // Tag Page
                hdfCompanyId.Value = Session["companyID"].ToString();
                hdfCurrentProjectId.Value = Request.QueryString["project_id"].ToString();
                hdfCurrentClientId.Value = Request.QueryString["client_id"].ToString();
                hdfWorkType.Value = Request.QueryString["work_type"].ToString();

                // Prepare initial data
                // ... For sortByList
                odsSortByList.DataBind();
                ddlSortBy.DataSourceID = "odsSortByList";
                ddlSortBy.DataValueField = "SortID";
                ddlSortBy.DataTextField = "Name";
                ddlSortBy.DataBind();

                // ... For
                odsViewForDisplayList.DataBind();
                odsViewForDisplayList2.DataBind();

                // ... For view ddl
                int companyId = Int32.Parse(hdfCompanyId.Value.Trim());
                string workType = hdfWorkType.Value;
                int loginId = Convert.ToInt32(Session["loginID"]);
                string viewTypeGlobal = "";
                string viewTypePersonal = "Personal";

                // Global Views check
                if (Convert.ToBoolean(Session["sgLFS_GLOBALVIEWS_VIEW"]))
                {
                    viewTypeGlobal = "Global";
                }

                WorkViewList workViewList = new WorkViewList();
                workViewList.LoadAndAddItem(workType, viewTypeGlobal, viewTypePersonal, loginId, companyId);
                ddlView.DataSource = workViewList.Table;
                ddlView.DataValueField = "ViewID";
                ddlView.DataTextField = "Name";
                ddlView.DataBind();
                ddlView.SelectedIndex = 1;

                WorkTypeViewSubAreaList workTypeViewSubAreaList = new WorkTypeViewSubAreaList();
                workTypeViewSubAreaList.LoadAndAddItem("Junction Lining", Int32.Parse(hdfCompanyId.Value), int.Parse(hdfCurrentProjectId.Value), "(All)");
                ddlSubArea.DataSource = workTypeViewSubAreaList.Table;
                ddlSubArea.DataValueField = "SubArea";
                ddlSubArea.DataTextField = "SubArea";
                ddlSubArea.DataBind();

                // ... for client
                int currentClientId = Int32.Parse(hdfCurrentClientId.Value.ToString());

                CompaniesGateway companiesGateway = new CompaniesGateway();
                companiesGateway.LoadByCompaniesId(currentClientId, companyId);
                lblTitleClientName.Text = "Client: " + companiesGateway.GetName(currentClientId);

                // ... for project
                int currentProjectId = Int32.Parse(hdfCurrentProjectId.Value.ToString());
                ProjectGateway projectGateway = new ProjectGateway();
                projectGateway.LoadByProjectId(currentProjectId);
                string name = projectGateway.GetName(currentProjectId);
                if (name.Length > 23) name = name.Substring(0, 20) + "...";
                lblTitleProjectName.Text = " > Project: " + name + " (" + projectGateway.GetProjectNumber(currentProjectId) + ")";

                // If coming from

                // ... Left Menu, select_project.aspx or Projects2.aspx
                if ((Request.QueryString["source_page"] == "lm") || (Request.QueryString["source_page"] == "select_project.aspx") || (Request.QueryString["source_page"] == "Projects2.aspx"))
                {
                    tdNoResults.Visible = false;
                }

                // ... jl_navigator2.aspx
                if (Request.QueryString["source_page"] == "jl_navigator2.aspx")
                {
                    RestoreNavigatorState();
                    if ((string)Request.QueryString["no_results"] == "yes")
                    {
                        tdNoResults.Visible = true;
                    }
                    else
                    {
                        tdNoResults.Visible = true;
                    }
                }
            }
        }
        private void RestoreNavigatorState()
        {
            // Search condition 1
            // Columns To Display
            string columnsToDisplay = Request.QueryString["columns_to_display"];
            string columnsToDisplay2 = Request.QueryString["columns_to_display2"];

            // Search condition
            // ... For Condition 1
            odsViewForDisplayList.DataBind();
            ddlCondition1.DataSourceID = "odsViewForDisplayList";
            ddlCondition1.DataValueField = "ConditionID";
            ddlCondition1.DataTextField = "Name";
            ddlCondition1.DataBind();
            ddlCondition1.SelectedValue = Request.QueryString["search_ddlCondition1"];
            tbxCondition1.Text = Request.QueryString["search_tbxCondition1"];
            ddlOperator1.SelectedValue = Request.QueryString["search_ddlOperator1"];

            // ... For Condition 2
            odsViewForDisplayList2.DataBind();
            ddlCondition2.DataSourceID = "odsViewForDisplayList2";
            ddlCondition2.DataValueField = "ConditionID";
            ddlCondition2.DataTextField = "Name";
            ddlCondition2.DataBind();
            ddlCondition2.SelectedValue = Request.QueryString["search_ddlCondition2"];
            tbxCondition2.Text = Request.QueryString["search_tbxCondition2"];
            ddlOperator2.SelectedValue = Request.QueryString["search_ddlOperator2"];

            // ... For View
            int companyId = Int32.Parse(hdfCompanyId.Value.Trim());
            string workType = hdfWorkType.Value;
            int loginId = Convert.ToInt32(Session["loginID"]);
            string viewTypeGlobal = "";
            string viewTypePersonal = "Personal";

            // Global Views check
            if (Convert.ToBoolean(Session["sgLFS_GLOBALVIEWS_VIEW"]))
            {
                viewTypeGlobal = "Global";
            }

            WorkViewList workViewList = new WorkViewList();
            workViewList.LoadAndAddItem(workType, viewTypeGlobal, viewTypePersonal, loginId, companyId);
            ddlView.DataSource = workViewList.Table;
            ddlView.DataValueField = "ViewID";
            ddlView.DataTextField = "Name";
            ddlView.DataBind();
            ddlView.SelectedValue = Request.QueryString["search_ddlView"];

            //Other values
            //... For SortBy
            odsSortByList.DataBind();
            ddlSortBy.DataSourceID = "odsSortByList";
            ddlSortBy.DataValueField = "SortID";
            ddlSortBy.DataTextField = "Name";
            ddlSortBy.DataBind();
            ddlSortBy.SelectedValue = Request.QueryString["search_sort_by"];

            // ... For BtnOrigin
            hdfBtnOrigin.Value = Request.QueryString["btn_origin"];

            cbxIdSection.Checked = (columnsToDisplay2.IndexOf("FlowOrderID") >= 0 ? true : false);
            cbxIdRepair.Checked = (columnsToDisplay2.IndexOf("RepairPointID") >= 0 ? true : false);
            cbxSubArea.Checked = (columnsToDisplay2.IndexOf("SubArea") >= 0 ? true : false);
            cbxStreet.Checked = (columnsToDisplay2.IndexOf("Street") >= 0 ? true : false);
            cbxUsmh.Checked = (columnsToDisplay2.IndexOf(" USMH,") >= 0 ? true : false);
            cbxUsmhAddress.Checked = (columnsToDisplay2.IndexOf("USMHAddress") >= 0 ? true : false);
            cbxDsmh.Checked = (columnsToDisplay2.IndexOf(" DSMH") >= 0 ? true : false);
            cbxDsmhAddress.Checked = (columnsToDisplay2.IndexOf("DSMHAddress") >= 0 ? true : false);
            cbxMapSize.Checked = (columnsToDisplay2.IndexOf("MapSize") >= 0 ? true : false);
            cbxConfirmedSize.Checked = (columnsToDisplay2.IndexOf("Size_") >= 0 ? true : false);
            cbxMapLength.Checked = (columnsToDisplay2.IndexOf("MapLength") >= 0 ? true : false);
            cbxSteelTapeLength.Checked = (columnsToDisplay2.IndexOf("Length") >= 0 ? true : false);
            cbxVideoLength.Checked = (columnsToDisplay2.IndexOf("VideoLength") >= 0 ? true : false);
            cbxLaterals.Checked = (columnsToDisplay2.IndexOf("Laterals") >= 0 ? true : false);
            cbxLiveLaterals.Checked = (columnsToDisplay2.IndexOf("LiveLaterals") >= 0 ? true : false);
            cbxClientId.Checked = (columnsToDisplay2.IndexOf("ClientID") >= 0 ? true : false);
            cbxMeasurementsTakenBy.Checked = (columnsToDisplay2.IndexOf("MeasurementTakenBy") >= 0 ? true : false);
            cbxPreFlushDate.Checked = (columnsToDisplay2.IndexOf("PreFlushDate") >= 0 ? true : false);
            cbxPreVideoDate.Checked = (columnsToDisplay2.IndexOf("PreVideoDate") >= 0 ? true : false);
            cbxP1Date.Checked = (columnsToDisplay2.IndexOf("P1Date") >= 0 ? true : false);
            cbxRepairConfirmationDate.Checked = (columnsToDisplay2.IndexOf("RepairConfirmationDate") >= 0 ? true : false);
            cbxTrafficControl.Checked = (columnsToDisplay2.IndexOf("TrafficControl") >= 0 ? true : false);
            cbxMaterial.Checked = (columnsToDisplay2.IndexOf("MaterialType") >= 0 ? true : false);
            cbxBypassRequired.Checked = (columnsToDisplay2.IndexOf("BypassRequired") >= 0 ? true : false);
            cbxRoboticPrepRequired.Checked = (columnsToDisplay2.IndexOf("RoboticPrepRequired") >= 0 ? true : false);
            cbxCXIsRemoved.Checked = (columnsToDisplay2.IndexOf("CXIsRemoved") >= 0 ? true : false);
            cbxRoboticDistances.Checked = (columnsToDisplay2.IndexOf("RoboticDistances") >= 0 ? true : false);
            cbxProposedLiningDate.Checked = (columnsToDisplay2.IndexOf("ProposedLiningDate") >= 0 ? true : false);
            cbxDeadlineLiningDate.Checked = (columnsToDisplay2.IndexOf("DeadlineLiningDate") >= 0 ? true : false);
            cbxGroutDate.Checked = (columnsToDisplay2.IndexOf("GroutDate") >= 0 ? true : false);
            cbxFinalVideo.Checked = (columnsToDisplay2.IndexOf("FinalVideoDate") >= 0 ? true : false);
            cbxEstimatedJoints.Checked = (columnsToDisplay2.IndexOf("EstimatedJoints") >= 0 ? true : false);
            cbxJointsTestSealed.Checked = (columnsToDisplay2.IndexOf("JointsTestSealed") >= 0 ? true : false);
            cbxIssueIdentified.Checked = (columnsToDisplay2.IndexOf("IssueIdentified") >= 0 ? true : false);
            cbxLFSIssue.Checked = (columnsToDisplay2.IndexOf("IssueLFS") >= 0 ? true : false);
            cbxClientIssue.Checked = (columnsToDisplay2.IndexOf("IssueClient") >= 0 ? true : false);
            cbxSalesIssue.Checked = (columnsToDisplay2.IndexOf("IssueSales") >= 0 ? true : false);
            cbxIssueGivenToClient.Checked = (columnsToDisplay2.IndexOf("IssueGivenToClient") >= 0 ? true : false);
            cbxIssueInvestigation.Checked = (columnsToDisplay2.IndexOf("IssueInvestigation") >= 0 ? true : false);
            cbxIssueResolved.Checked = (columnsToDisplay2.IndexOf("IssueResolved") >= 0 ? true : false);
            cbxComments.Checked = (columnsToDisplay2.IndexOf("Comments") >= 0 ? true : false);
            cbxRepairType.Checked = (columnsToDisplay2.IndexOf("Type") >= 0 ? true : false);
            cbxDefectQualifier.Checked = (columnsToDisplay2.IndexOf("DefectQualifier") >= 0 ? true : false);
            cbxDefectDetails.Checked = (columnsToDisplay2.IndexOf("DefectDetails") >= 0 ? true : false);
            cbxExtraRepair.Checked = (columnsToDisplay2.IndexOf("ExtraRepair") >= 0 ? true : false);
            cbxCancelled.Checked = (columnsToDisplay2.IndexOf("Cancelled") >= 0 ? true : false);
            cbxApproval.Checked = (columnsToDisplay2.IndexOf("Approval") >= 0 ? true : false);
            cbxRepairComments.Checked = (columnsToDisplay2.IndexOf("Comments") >= 0 ? true : false);
            cbxReamDistance.Checked = (columnsToDisplay2.IndexOf("ReamDistance") >= 0 ? true : false);
            cbxReamDate.Checked = (columnsToDisplay2.IndexOf("ReamDate") >= 0 ? true : false);
            cbxLinerDistance.Checked = (columnsToDisplay2.IndexOf("LinerDistance") >= 0 ? true : false);
            cbxDirection.Checked = (columnsToDisplay2.IndexOf("Direction") >= 0 ? true : false);
            cbxReinstates.Checked = (columnsToDisplay2.IndexOf("Reinstates") >= 0 ? true : false);
            cbxLtMh.Checked = (columnsToDisplay2.IndexOf("LTMH") >= 0 ? true : false);
            cbxVtMh.Checked = (columnsToDisplay2.IndexOf("VTMH") >= 0 ? true : false);
            cbxDistance.Checked = (columnsToDisplay2.IndexOf("Distance") >= 0 ? true : false);
            cbxRepairSize.Checked = (columnsToDisplay2.IndexOf("Size_") >= 0 ? true : false);
            cbxRepairLength.Checked = (columnsToDisplay2.IndexOf("Length") >= 0 ? true : false);
            cbxInstallDate.Checked = (columnsToDisplay2.IndexOf("InstallDate") >= 0 ? true : false);
            cbxMhShot.Checked = (columnsToDisplay2.IndexOf("MHShot") >= 0 ? true : false);
            cbxGroutDistance.Checked = (columnsToDisplay2.IndexOf("GroutDistance") >= 0 ? true : false);

            // Grid's columns
            grdPrNavigator.Columns[2].Visible = (columnsToDisplay.IndexOf("FlowOrderID") >= 0 ? true : false);
            grdPrNavigator.Columns[3].Visible = (columnsToDisplay.IndexOf("SubArea") >= 0 ? true : false);
            grdPrNavigator.Columns[4].Visible = (columnsToDisplay.IndexOf("Street") >= 0 ? true : false);
            grdPrNavigator.Columns[5].Visible = (columnsToDisplay.IndexOf(" USMH,") >= 0 ? true : false);
            grdPrNavigator.Columns[6].Visible = (columnsToDisplay.IndexOf("USMHAddress") >= 0 ? true : false);
            grdPrNavigator.Columns[7].Visible = (columnsToDisplay.IndexOf(" DSMH") >= 0 ? true : false);
            grdPrNavigator.Columns[8].Visible = (columnsToDisplay.IndexOf("DSMHAddress") >= 0 ? true : false);
            grdPrNavigator.Columns[9].Visible = (columnsToDisplay.IndexOf("MapSize") >= 0 ? true : false);
            grdPrNavigator.Columns[10].Visible = (columnsToDisplay.IndexOf("Size_") >= 0 ? true : false);
            grdPrNavigator.Columns[11].Visible = (columnsToDisplay.IndexOf("MapLength") >= 0 ? true : false);
            grdPrNavigator.Columns[12].Visible = (columnsToDisplay.IndexOf("Length") >= 0 ? true : false);
            grdPrNavigator.Columns[13].Visible = (columnsToDisplay.IndexOf("VideoLength") >= 0 ? true : false);
            grdPrNavigator.Columns[14].Visible = (columnsToDisplay.IndexOf("Laterals") >= 0 ? true : false);
            grdPrNavigator.Columns[15].Visible = (columnsToDisplay.IndexOf("LiveLaterals") >= 0 ? true : false);
            grdPrNavigator.Columns[16].Visible = (columnsToDisplay.IndexOf("ClientID") >= 0 ? true : false);
            grdPrNavigator.Columns[17].Visible = (columnsToDisplay.IndexOf("MeasurementTakenBy") >= 0 ? true : false);
            grdPrNavigator.Columns[18].Visible = (columnsToDisplay.IndexOf("PreFlushDate") >= 0 ? true : false);
            grdPrNavigator.Columns[19].Visible = (columnsToDisplay.IndexOf("PreVideoDate") >= 0 ? true : false);
            grdPrNavigator.Columns[20].Visible = (columnsToDisplay.IndexOf("P1Date") >= 0 ? true : false);
            grdPrNavigator.Columns[21].Visible = (columnsToDisplay.IndexOf("RepairConfirmationDate") >= 0 ? true : false);
            grdPrNavigator.Columns[22].Visible = (columnsToDisplay.IndexOf("TrafficControl") >= 0 ? true : false);
            grdPrNavigator.Columns[23].Visible = (columnsToDisplay.IndexOf("MaterialType") >= 0 ? true : false);
            grdPrNavigator.Columns[24].Visible = (columnsToDisplay.IndexOf("BypassRequired") >= 0 ? true : false);
            grdPrNavigator.Columns[25].Visible = (columnsToDisplay.IndexOf("RoboticPrepRequired") >= 0 ? true : false);
            grdPrNavigator.Columns[26].Visible = (columnsToDisplay.IndexOf("CXIsRemoved") >= 0 ? true : false);
            grdPrNavigator.Columns[27].Visible = (columnsToDisplay.IndexOf("RoboticDistances") >= 0 ? true : false);
            grdPrNavigator.Columns[28].Visible = (columnsToDisplay.IndexOf("ProposedLiningDate") >= 0 ? true : false);
            grdPrNavigator.Columns[29].Visible = (columnsToDisplay.IndexOf("DeadlineLiningDate") >= 0 ? true : false);
            grdPrNavigator.Columns[30].Visible = (columnsToDisplay.IndexOf("FinalVideoDate") >= 0 ? true : false);
            grdPrNavigator.Columns[31].Visible = (columnsToDisplay.IndexOf("EstimatedJoints") >= 0 ? true : false);
            grdPrNavigator.Columns[32].Visible = (columnsToDisplay.IndexOf("JointsTestSealed") >= 0 ? true : false);
            grdPrNavigator.Columns[33].Visible = (columnsToDisplay.IndexOf("IssueIdentified") >= 0 ? true : false);
            grdPrNavigator.Columns[34].Visible = (columnsToDisplay.IndexOf("IssueLFS") >= 0 ? true : false);
            grdPrNavigator.Columns[35].Visible = (columnsToDisplay.IndexOf("IssueClient") >= 0 ? true : false);
            grdPrNavigator.Columns[36].Visible = (columnsToDisplay.IndexOf("IssueSales") >= 0 ? true : false);
            grdPrNavigator.Columns[37].Visible = (columnsToDisplay.IndexOf("IssueGivenToClient") >= 0 ? true : false);
            grdPrNavigator.Columns[38].Visible = (columnsToDisplay.IndexOf("IssueInvestigation") >= 0 ? true : false);
            grdPrNavigator.Columns[39].Visible = (columnsToDisplay.IndexOf("IssueResolved") >= 0 ? true : false);
            grdPrNavigator.Columns[40].Visible = (columnsToDisplay.IndexOf("Comments") >= 0 ? true : false);
            grdPrNavigator.Columns[41].Visible = false;
            grdPrNavigator.Columns[41].Visible = (columnsToDisplay.IndexOf("RepairPointID") >= 0 ? true : false);

            // Special case for repairs
            // For condition 1
            WorkTypeViewConditionGateway workTypeViewConditionGateway = new WorkTypeViewConditionGateway();
            workTypeViewConditionGateway.LoadByWorkTypeConditionId(workType, int.Parse(ddlCondition1.SelectedValue), companyId);

            string name = workTypeViewConditionGateway.GetName(workType, companyId, int.Parse(ddlCondition1.SelectedValue));
            string conditionValue1 = workTypeViewConditionGateway.GetColumn_(workType, companyId, int.Parse(ddlCondition1.SelectedValue));

            if ((conditionValue1 == "RepairPointID") || (conditionValue1 == "Type") || (conditionValue1 == "DefectQualifier") || (conditionValue1 == "DefectDetails") || (conditionValue1 == "ExtraRepair") || (conditionValue1 == "Cancelled") || (conditionValue1 == "Approval") || (conditionValue1 == "Comments" && name == "Repair Comments") || (conditionValue1 == "ReamDistance") || (conditionValue1 == "ReamDate") || (conditionValue1 == "LinerDistance") || (conditionValue1 == "Direction") || (conditionValue1 == "Reinstates") || (conditionValue1 == "LTMH") || (conditionValue1 == "VTMH") || (conditionValue1 == "Distance") || (conditionValue1 == "Size_" && name == "Repair Size") || (conditionValue1 == "Length" && name == "Repair Length") || (conditionValue1 == "InstallDate") || (conditionValue1 == "MHShot") || (conditionValue1 == "GroutDistance") || (conditionValue1 == "GroutDate"))
            {
                grdPrNavigator.Columns[41].Visible = true;
            }

            if (ddlCondition2.SelectedValue != "-1")
            {
                WorkTypeViewConditionGateway workTypeViewConditionGateway2 = new WorkTypeViewConditionGateway();
                workTypeViewConditionGateway2.LoadByWorkTypeConditionId(workType, int.Parse(ddlCondition2.SelectedValue), companyId);

                string name2 = workTypeViewConditionGateway2.GetName(workType, companyId, int.Parse(ddlCondition2.SelectedValue));
                string conditionValue2 = workTypeViewConditionGateway2.GetColumn_(workType, companyId, int.Parse(ddlCondition2.SelectedValue));
                if ((conditionValue2 == "RepairPointID") || (conditionValue2 == "Type") || (conditionValue2 == "DefectQualifier") || (conditionValue2 == "DefectDetails") || (conditionValue2 == "ExtraRepair") || (conditionValue2 == "Cancelled") || (conditionValue2 == "Approval") || (conditionValue2 == "Comments" && name == "Repair Comments") || (conditionValue2 == "ReamDistance") || (conditionValue2 == "ReamDate") || (conditionValue2 == "LinerDistance") || (conditionValue2 == "Direction") || (conditionValue2 == "Reinstates") || (conditionValue2 == "LTMH") || (conditionValue2 == "VTMH") || (conditionValue2 == "Distance") || (conditionValue2 == "Size_" && name == "Repair Size") || (conditionValue2 == "Length" && name == "Repair Length") || (conditionValue2 == "InstallDate") || (conditionValue2 == "MHShot") || (conditionValue2 == "GroutDistance") || (conditionValue2 == "GroutDate"))
                {
                    grdPrNavigator.Columns[41].Visible = true;
                }
            }
        }
        private void RestoreNavigatorState()
        {
            // Columns To Display
            string columnsToDisplay = Request.QueryString["columns_to_display"];
            string columnsToDisplay2 = Request.QueryString["columns_to_display2"];

            // Search condition
            // ... For Condition 1
            odsViewForDisplayList.DataBind();
            ddlCondition1.DataSourceID = "odsViewForDisplayList";
            ddlCondition1.DataValueField = "ConditionID";
            ddlCondition1.DataTextField = "Name";
            ddlCondition1.DataBind();
            ddlCondition1.SelectedValue = Request.QueryString["search_ddlCondition1"];
            tbxCondition1.Text = Request.QueryString["search_tbxCondition1"];
            ddlOperator1.SelectedValue = Request.QueryString["search_ddlOperator1"];

            // ... For Condition 2
            odsViewForDisplayList2.DataBind();
            ddlCondition2.DataSourceID = "odsViewForDisplayList2";
            ddlCondition2.DataValueField = "ConditionID";
            ddlCondition2.DataTextField = "Name";
            ddlCondition2.DataBind();
            ddlCondition2.SelectedValue = Request.QueryString["search_ddlCondition2"];
            tbxCondition2.Text = Request.QueryString["search_tbxCondition2"];
            ddlOperator2.SelectedValue = Request.QueryString["search_ddlOperator2"];

            // ... For View
            int companyId = Int32.Parse(hdfCompanyId.Value.Trim());
            string workType = hdfWorkType.Value;
            int loginId = Convert.ToInt32(Session["loginID"]);
            string viewTypeGlobal = "";
            string viewTypePersonal = "Personal";

            // Global Views check
            if (Convert.ToBoolean(Session["sgLFS_GLOBALVIEWS_VIEW"]))
            {
                viewTypeGlobal = "Global";
            }

            WorkViewList workViewList = new WorkViewList();
            workViewList.LoadAndAddItem(workType, viewTypeGlobal, viewTypePersonal, loginId, companyId);
            ddlView.DataSource = workViewList.Table;
            ddlView.DataValueField = "ViewID";
            ddlView.DataTextField = "Name";
            ddlView.DataBind();
            ddlView.SelectedValue = Request.QueryString["search_ddlView"];

            //Other values
            //... For SortBy
            odsSortByList.DataBind();
            ddlSortBy.DataSourceID = "odsSortByList";
            ddlSortBy.DataValueField = "SortID";
            ddlSortBy.DataTextField = "Name";
            ddlSortBy.DataBind();
            ddlSortBy.SelectedValue = Request.QueryString["search_sort_by"];
            ddlSubArea.SelectedValue = Request.QueryString["search_sub_area"];

            // ... For BtnOrigin
            hdfBtnOrigin.Value = Request.QueryString["btn_origin"];

            cbxId.Checked = (columnsToDisplay2.IndexOf("SectionID") >= 0 ? true : false);
            cbxOldCwpId.Checked = (columnsToDisplay2.IndexOf("OriginalSectionID") >= 0 ? true : false);
            cbxClientLateralId.Checked = (columnsToDisplay2.IndexOf("ClientLateralId") >= 0 ? true : false);
            cbxHamiltonInspectionNumber.Checked = (columnsToDisplay2.IndexOf("HamiltonInspectionNumber") >= 0 ? true : false);
            cbxStreet.Checked = (columnsToDisplay2.IndexOf("Street") >= 0 ? true : false);
            cbxAddress.Checked = (columnsToDisplay2.IndexOf("MN") >= 0 ? true : false);
            cbxUSMH.Checked = (columnsToDisplay2.IndexOf("U_SMH") >= 0 ? true : false);
            cbxDSMH.Checked = (columnsToDisplay2.IndexOf("D_SMH") >= 0 ? true : false);
            cbxVideoInspection.Checked = (columnsToDisplay2.IndexOf("VideoInspection") >= 0 ? true : false);
            cbxVideoLengthToPropertyLine.Checked = (columnsToDisplay2.IndexOf("VideoLengthToPropertyLine") >= 0 ? true : false);
            cbxPipeLocated.Checked = (columnsToDisplay2.IndexOf("PipeLocated") >= 0 ? true : false);
            cbxServicesLocated.Checked = (columnsToDisplay2.IndexOf("ServicesLocated") >= 0 ? true : false);
            //cbxCoRequired.Checked = (columnsToDisplay2.IndexOf("CoRequired") >= 0 ? true : false);
            //cbxPitRequired.Checked = (columnsToDisplay2.IndexOf("PitRequired") >= 0 ? true : false);
            cbxPrepType.Checked = (columnsToDisplay2.IndexOf("PrepType") >= 0 ? true : false);
            cbxCoPitLocation.Checked = (columnsToDisplay2.IndexOf("CoPitLocation") >= 0 ? true : false);
            cbxCoInstalled.Checked = (columnsToDisplay2.IndexOf("CoInstalled") >= 0 ? true : false);
            cbxBackfilledConcrete.Checked = (columnsToDisplay2.IndexOf("BackfilledConcrete") >= 0 ? true : false);
            cbxBackfilledSoil.Checked = (columnsToDisplay2.IndexOf("BackfilledSoil") >= 0 ? true : false);
            cbxGrouted.Checked = (columnsToDisplay2.IndexOf("Grouted") >= 0 ? true : false);
            cbxCored.Checked = (columnsToDisplay2.IndexOf("Cored") >= 0 ? true : false);
            cbxPrepped.Checked = (columnsToDisplay2.IndexOf("Prepped") >= 0 ? true : false);
            cbxPreVideo.Checked = (columnsToDisplay2.IndexOf("PreVideo") >= 0 ? true : false);
            cbxMeasured.Checked = (columnsToDisplay2.IndexOf("Measured") >= 0 ? true : false);
            cbxConnectionType.Checked = (columnsToDisplay2.IndexOf("ConnectionType") >= 0 ? true : false);
            cbxLinerType.Checked = (columnsToDisplay2.IndexOf("LinerType") >= 0 ? true : false);
            cbxFlange.Checked = (columnsToDisplay2.IndexOf("Flange") >= 0 ? true : false);
            cbxGasket.Checked = (columnsToDisplay2.IndexOf("Gasket") >= 0 ? true : false);
            cbxMainSize.Checked = (columnsToDisplay2.IndexOf("MainSize") >= 0 ? true : false);
            cbxLinerSize.Checked = (columnsToDisplay2.IndexOf("LinerSize") >= 0 ? true : false);
            //cbxLiningThruCo.Checked = (columnsToDisplay2.IndexOf("LiningThruCo") >= 0 ? true : false);
            cbxNoticeDelivered.Checked = (columnsToDisplay2.IndexOf("NoticeD_elivered") >= 0 ? true : false);
            cbxInProcess.Checked = (columnsToDisplay2.IndexOf("InProcess") >= 0 ? true : false);
            cbxInStock.Checked = (columnsToDisplay2.IndexOf("InStock") >= 0 ? true : false);
            cbxDelivered.Checked = (columnsToDisplay2.IndexOf("Delivered") >= 0 ? true : false);
            cbxLinerInstalled.Checked = (columnsToDisplay2.IndexOf("LinerInstalled") >= 0 ? true : false);
            cbxFinalVideo.Checked = (columnsToDisplay2.IndexOf("FinalVideo") >= 0 ? true : false);
            cbxDistanceFromUSMH.Checked = (columnsToDisplay2.IndexOf("DistanceFromUSMH") >= 0 ? true : false);
            cbxDistanceFromDSMH.Checked = (columnsToDisplay2.IndexOf("DistanceFromDSMH") >= 0 ? true : false);
            //cbxPostContractDigRequired.Checked = (columnsToDisplay2.IndexOf("PostContractDigRequired") >= 0 ? true : false);
            cbxCoCutDown.Checked = (columnsToDisplay2.IndexOf("CoCutDown") >= 0 ? true : false);
            cbxFinalRestoration.Checked = (columnsToDisplay2.IndexOf("FinalRestoration") >= 0 ? true : false);
            cbxCost.Checked = (columnsToDisplay2.IndexOf("Cost") >= 0 ? true : false);
            cbxBuidRebuid.Checked = (columnsToDisplay2.IndexOf("BuildRebuild") >= 0 ? true : false);
            cbxComments.Checked = (columnsToDisplay2.IndexOf("Comments") >= 0 ? true : false);
            cbxHistory.Checked = (columnsToDisplay2.IndexOf("History") >= 0 ? true : false);
            cbxDigRequiredPriorToLining.Checked = (columnsToDisplay2.IndexOf("DigRequiredPriorToLining") >= 0 ? true : false);
            cbxDigRequiredPriorToLiningCompleted.Checked = (columnsToDisplay2.IndexOf("DigRequiredPriorToLiningCompleted") >= 0 ? true : false);
            cbxDigRequiredAfterLining.Checked = (columnsToDisplay2.IndexOf("DigRequiredAfterLining") >= 0 ? true : false);
            cbxDigRequiredAfterLiningCompleted.Checked = (columnsToDisplay2.IndexOf("DigRequiredAfterLiningCompleted") >= 0 ? true : false);
            cbxOutOfScope.Checked = (columnsToDisplay2.IndexOf("OutOfScope") >= 0 ? true : false);
            cbxHoldClientIssue.Checked = (columnsToDisplay2.IndexOf("HoldClientIssue") >= 0 ? true : false);
            cbxHoldClientIssueResolved.Checked = (columnsToDisplay2.IndexOf("HoldClientIssueResolved") >= 0 ? true : false);
            cbxHoldLFSIssue.Checked = (columnsToDisplay2.IndexOf("HoldLFSIssue") >= 0 ? true : false);
            cbxHoldLFSIssueResolved.Checked = (columnsToDisplay2.IndexOf("HoldLFSIssueResolved") >= 0 ? true : false);
            cbxRequiresRoboticPrep.Checked = (columnsToDisplay2.IndexOf("LateralRequiresRoboticPrep") >= 0 ? true : false);
            cbxRequiresRoboticPrepCompleted.Checked = (columnsToDisplay2.IndexOf("LateralRequiresRoboticPrepCompleted") >= 0 ? true : false);
            cbxDyeTestReq.Checked = (columnsToDisplay2.IndexOf("DyeTestReq") >= 0 ? true : false);
            cbxDyeTestComplete.Checked = (columnsToDisplay2.IndexOf("DyeTestComplete") >= 0 ? true : false);
            cbxContractYear.Checked = (columnsToDisplay2.IndexOf("ContractYear") >= 0 ? true : false);
        }
        private void RestoreNavigatorState()
        {
            // Columns To Display
            string columnsToDisplay = Request.QueryString["columns_to_display"];

            // Search condition 1
            // ... For Condition
            odsViewForDisplayList.DataBind();
            ddlCondition1.DataSourceID = "odsViewForDisplayList";
            ddlCondition1.DataValueField = "ConditionID";
            ddlCondition1.DataTextField = "Name";
            ddlCondition1.DataBind();
            ddlCondition1.SelectedValue = Request.QueryString["search_ddlCondition1"];

            // ... For text for search
            tbxCondition1.Text = Request.QueryString["search_tbxCondition1"];

            // ... For View
            int companyId = Int32.Parse(hdfCompanyId.Value.Trim());
            string workType = hdfWorkType.Value;
            int loginId = Convert.ToInt32(Session["loginID"]);
            string viewTypeGlobal = "";
            string viewTypePersonal = "Personal";

            // Global Views check
            if (Convert.ToBoolean(Session["sgLFS_GLOBALVIEWS_VIEW"]))
            {
                viewTypeGlobal = "Global";
            }

            WorkViewList workViewList = new WorkViewList();
            workViewList.LoadAndAddItem(workType, viewTypeGlobal, viewTypePersonal, loginId, companyId);
            ddlView.DataSource = workViewList.Table;
            ddlView.DataValueField = "ViewID";
            ddlView.DataTextField = "Name";
            ddlView.DataBind();
            ddlView.SelectedValue = Request.QueryString["search_ddlView"];

            //Other values
            //... For SortBy
            odsSortByList.DataBind();
            ddlSortBy.DataSourceID = "odsSortByList";
            ddlSortBy.DataValueField = "SortID";
            ddlSortBy.DataTextField = "Name";
            ddlSortBy.DataBind();
            ddlSortBy.SelectedValue = Request.QueryString["search_sort_by"];

            // ... For BtnOrigin
            hdfBtnOrigin.Value = Request.QueryString["btn_origin"];

            // Grid's columns
            grdRANavigator.Columns[2].Visible = (columnsToDisplay.IndexOf("SectionID") >= 0 ? true : false);
            grdRANavigator.Columns[3].Visible = (columnsToDisplay.IndexOf("OriginalSectionID") >= 0 ? true : false);
            grdRANavigator.Columns[4].Visible = (columnsToDisplay.IndexOf("SubArea") >= 0 ? true : false);
            grdRANavigator.Columns[5].Visible = (columnsToDisplay.IndexOf("Street") >= 0 ? true : false);
            grdRANavigator.Columns[6].Visible = (columnsToDisplay.Contains("USMH,") ? true : false);
            grdRANavigator.Columns[7].Visible = (columnsToDisplay.Contains("DSMH") ? true : false);
            grdRANavigator.Columns[8].Visible = (columnsToDisplay.IndexOf("PreFlushDate") >= 0 ? true : false);
            grdRANavigator.Columns[9].Visible = (columnsToDisplay.IndexOf("PreVideoDate") >= 0 ? true : false);
            grdRANavigator.Columns[10].Visible = (columnsToDisplay.IndexOf("MapSize") >= 0 ? true : false);
            grdRANavigator.Columns[11].Visible = (columnsToDisplay.Contains("MapLength") ? true : false);
            grdRANavigator.Columns[12].Visible = (columnsToDisplay.Contains("Thickness") ? true : false);
            grdRANavigator.Columns[13].Visible = (columnsToDisplay.IndexOf("Size_") >= 0 ? true : false);
            grdRANavigator.Columns[14].Visible = (columnsToDisplay.Contains("Length") ? true : false);
            grdRANavigator.Columns[15].Visible = (columnsToDisplay.IndexOf("Comment") >= 0 ? true : false);
            grdRANavigator.Columns[16].Visible = (columnsToDisplay.Contains("VideoLength") ? true : false);
            grdRANavigator.Columns[17].Visible = (columnsToDisplay.Contains("Laterals") ? true : false);
            grdRANavigator.Columns[18].Visible = (columnsToDisplay.Contains("LiveLaterals") ? true : false);
            grdRANavigator.Columns[19].Visible = (columnsToDisplay.IndexOf("ClientID") >= 0 ? true : false);
            grdRANavigator.Columns[20].Visible = (columnsToDisplay.IndexOf("P1Date") >= 0 ? true : false);
            grdRANavigator.Columns[21].Visible = (columnsToDisplay.IndexOf("CXIsRemoved") >= 0 ? true : false);
            grdRANavigator.Columns[22].Visible = (columnsToDisplay.IndexOf("M1Date") >= 0 ? true : false);
            grdRANavigator.Columns[23].Visible = (columnsToDisplay.IndexOf("MeasurementTakenBy") >= 0 ? true : false);
            grdRANavigator.Columns[24].Visible = (columnsToDisplay.IndexOf("MaterialType") >= 0 ? true : false);
            grdRANavigator.Columns[25].Visible = (columnsToDisplay.IndexOf("USMHAddress") >= 0 ? true : false);
            grdRANavigator.Columns[26].Visible = (columnsToDisplay.IndexOf("USMHDepth") >= 0 ? true : false);
            grdRANavigator.Columns[27].Visible = (columnsToDisplay.IndexOf("USMHMouth12") >= 0 ? true : false);
            grdRANavigator.Columns[28].Visible = (columnsToDisplay.IndexOf("USMHMouth1,") >= 0 ? true : false);
            grdRANavigator.Columns[29].Visible = (columnsToDisplay.IndexOf("USMHMouth2") >= 0 ? true : false);
            grdRANavigator.Columns[30].Visible = (columnsToDisplay.IndexOf("USMHMouth3") >= 0 ? true : false);
            grdRANavigator.Columns[31].Visible = (columnsToDisplay.IndexOf("USMHMouth4") >= 0 ? true : false);
            grdRANavigator.Columns[32].Visible = (columnsToDisplay.IndexOf("USMHMouth5") >= 0 ? true : false);
            grdRANavigator.Columns[33].Visible = (columnsToDisplay.IndexOf("DSMHAddress") >= 0 ? true : false);
            grdRANavigator.Columns[34].Visible = (columnsToDisplay.IndexOf("DSMHDepth") >= 0 ? true : false);
            grdRANavigator.Columns[35].Visible = (columnsToDisplay.IndexOf("DSMHMouth12") >= 0 ? true : false);
            grdRANavigator.Columns[36].Visible = (columnsToDisplay.IndexOf("DSMHMouth1,") >= 0 ? true : false);
            grdRANavigator.Columns[37].Visible = (columnsToDisplay.IndexOf("DSMHMouth2") >= 0 ? true : false);
            grdRANavigator.Columns[38].Visible = (columnsToDisplay.IndexOf("DSMHMouth3") >= 0 ? true : false);
            grdRANavigator.Columns[39].Visible = (columnsToDisplay.IndexOf("DSMHMouth4") >= 0 ? true : false);
            grdRANavigator.Columns[40].Visible = (columnsToDisplay.IndexOf("DSMHMouth5") >= 0 ? true : false);
            grdRANavigator.Columns[41].Visible = (columnsToDisplay.IndexOf("TrafficControl") >= 0 ? true : false);
            grdRANavigator.Columns[42].Visible = (columnsToDisplay.IndexOf("SiteDetails") >= 0 ? true : false);
            grdRANavigator.Columns[43].Visible = (columnsToDisplay.IndexOf("PipeSizeChange") >= 0 ? true : false);
            grdRANavigator.Columns[44].Visible = (columnsToDisplay.IndexOf("StandardBypass") >= 0 ? true : false);
            grdRANavigator.Columns[45].Visible = (columnsToDisplay.IndexOf("StandardBypassComments") >= 0 ? true : false);
            grdRANavigator.Columns[46].Visible = (columnsToDisplay.IndexOf("TrafficControlDetails") >= 0 ? true : false);
            grdRANavigator.Columns[47].Visible = (columnsToDisplay.IndexOf("MeasurementType") >= 0 ? true : false);
            grdRANavigator.Columns[48].Visible = (columnsToDisplay.IndexOf("MeasurementFromMH") >= 0 ? true : false);
            grdRANavigator.Columns[49].Visible = (columnsToDisplay.IndexOf("VideoDoneFromMH") >= 0 ? true : false);
            grdRANavigator.Columns[50].Visible = (columnsToDisplay.IndexOf("VideoDoneToMH") >= 0 ? true : false);
            grdRANavigator.Columns[51].Visible = (columnsToDisplay.IndexOf("RoboticPrepCompleted") >= 0 ? true : false);
            grdRANavigator.Columns[52].Visible = (columnsToDisplay.IndexOf("RoboticPrepCompletedDate") >= 0 ? true : false);
        }
        private void RestoreNavigatorState()
        {
            // Search condition 1
            // Columns To Display
            string columnsToDisplay = Request.QueryString["columns_to_display"];
            string columnsToDisplay2 = Request.QueryString["columns_to_display2"];

            // Search condition
            // ... For Condition 1
            odsViewForDisplayList.DataBind();
            ddlCondition1.DataSourceID = "odsViewForDisplayList";
            ddlCondition1.DataValueField = "ConditionID";
            ddlCondition1.DataTextField = "Name";
            ddlCondition1.DataBind();
            ddlCondition1.SelectedValue = Request.QueryString["search_ddlCondition1"];

            tbxCondition1.Text = Request.QueryString["search_tbxCondition1"];
            ddlOperator1.SelectedValue = Request.QueryString["search_ddlOperator1"];

            // ... For Condition 2
            odsViewForDisplayList2.DataBind();
            ddlCondition2.DataSourceID = "odsViewForDisplayList2";
            ddlCondition2.DataValueField = "ConditionID";
            ddlCondition2.DataTextField = "Name";
            ddlCondition2.DataBind();
            ddlCondition2.SelectedValue = Request.QueryString["search_ddlCondition2"];
            tbxCondition2.Text = Request.QueryString["search_tbxCondition2"];
            ddlOperator2.SelectedValue = Request.QueryString["search_ddlOperator2"];

            // ... For View
            int companyId = Int32.Parse(hdfCompanyId.Value.Trim());
            string workType = hdfWorkType.Value;
            int loginId = Convert.ToInt32(Session["loginID"]);
            string viewTypeGlobal = "";
            string viewTypePersonal = "Personal";

            // Global Views check
            if (Convert.ToBoolean(Session["sgLFS_GLOBALVIEWS_VIEW"]))
            {
                viewTypeGlobal = "Global";
            }

            WorkViewList workViewList = new WorkViewList();
            workViewList.LoadAndAddItem(workType, viewTypeGlobal, viewTypePersonal, loginId, companyId);
            ddlView.DataSource = workViewList.Table;
            ddlView.DataValueField = "ViewID";
            ddlView.DataTextField = "Name";
            ddlView.DataBind();
            ddlView.SelectedValue = Request.QueryString["search_ddlView"];

            //Other values
            //... For SortBy
            odsSortByList.DataBind();
            ddlSortBy.DataSourceID = "odsSortByList";
            ddlSortBy.DataValueField = "SortID";
            ddlSortBy.DataTextField = "Name";
            ddlSortBy.DataBind();
            ddlSortBy.SelectedValue = Request.QueryString["search_sort_by"];

            // ... For BtnOrigin
            hdfBtnOrigin.Value = Request.QueryString["btn_origin"];

            cbxIdSection.Checked = (columnsToDisplay2.IndexOf(" SectionID,") >= 0 ? true : false);
            cbxOldCWPID.Checked = (columnsToDisplay2.IndexOf("OriginalSectionID") >= 0 ? true : false);
            cbxSubArea.Checked = (columnsToDisplay2.IndexOf("SubArea") >= 0 ? true : false);
            cbxStreet.Checked = (columnsToDisplay2.IndexOf("Street") >= 0 ? true : false);
            cbxUsmh.Checked = (columnsToDisplay2.IndexOf(" USMH,") >= 0 ? true : false);
            cbxDSMH.Checked = (columnsToDisplay2.IndexOf(" DSMH") >= 0 ? true : false);
            cbxProposedLiningDate.Checked = (columnsToDisplay2.IndexOf("ProposedLiningDate") >= 0 ? true : false);
            cbxDeadlineLiningDate.Checked = (columnsToDisplay2.IndexOf("DeadlineLiningDate") >= 0 ? true : false);
            cbxP1Date.Checked = (columnsToDisplay2.IndexOf("P1Date") >= 0 ? true : false);
            cbxM1Date.Checked = (columnsToDisplay2.IndexOf("M1Date") >= 0 ? true : false);
            cbxM2Date.Checked = (columnsToDisplay2.IndexOf("M2Date") >= 0 ? true : false);
            cbxInstallDate.Checked = (columnsToDisplay2.IndexOf("InstallDate") >= 0 ? true : false);
            cbxFinalVideoDate.Checked = (columnsToDisplay2.IndexOf("FinalVideoDate") >= 0 ? true : false);
            cbxConfirmedSize.Checked = (columnsToDisplay2.IndexOf("Size_") >= 0 ? true : false);
            cbxActualLength.Checked = (columnsToDisplay2.IndexOf("ActualLength") >= 0 ? true : false);
            cbxComments.Checked = (columnsToDisplay2.IndexOf(" Comments") >= 0 ? true : false);
            cbxMapSize.Checked = (columnsToDisplay2.IndexOf("MapSize") >= 0 ? true : false);
            cbxMapLength.Checked = (columnsToDisplay2.IndexOf("MapLength") >= 0 ? true : false);
            cbxVideoLength.Checked = (columnsToDisplay2.IndexOf("VideoLength") >= 0 ? true : false);
            cbxLaterals.Checked = (columnsToDisplay2.IndexOf(" Laterals") >= 0 ? true : false);
            cbxLiveLaterals.Checked = (columnsToDisplay2.IndexOf("LiveLaterals") >= 0 ? true : false);
            cbxClientID.Checked = (columnsToDisplay2.IndexOf("ClientID") >= 0 ? true : false);
            cbxPreFlushDate.Checked = (columnsToDisplay2.IndexOf("PreFlushDate") >= 0 ? true : false);
            cbxPreVideoDate.Checked = (columnsToDisplay2.IndexOf("PreVideoDate") >= 0 ? true : false);
            cbxIssueIdentified.Checked = (columnsToDisplay2.IndexOf("IssueIdentified") >= 0 ? true : false);
            cbxLFSIssue.Checked = (columnsToDisplay2.IndexOf("IssueLFS") >= 0 ? true : false);
            cbxClientIssue.Checked = (columnsToDisplay2.IndexOf("IssueClient") >= 0 ? true : false);
            cbxSalesIssue.Checked = (columnsToDisplay2.IndexOf("IssueSales") >= 0 ? true : false);
            cbxIssueGivenToClient.Checked = (columnsToDisplay2.IndexOf("IssueGivenToClient") >= 0 ? true : false);
            cbxIssueInvestigation.Checked = (columnsToDisplay2.IndexOf("IssueInvestigation") >= 0 ? true : false);
            cbxIssueResolved.Checked = (columnsToDisplay2.IndexOf("IssueResolved") >= 0 ? true : false);
            cbxCXIsRemoved.Checked = (columnsToDisplay2.IndexOf("CXIsRemoved") >= 0 ? true : false);
            cbxMaterial.Checked = (columnsToDisplay2.IndexOf("MaterialType") >= 0 ? true : false);
            cbxUSMHAddress.Checked = (columnsToDisplay2.IndexOf("USMHAddress") >= 0 ? true : false);
            cbxUSMHDepth.Checked = (columnsToDisplay2.IndexOf("USMHDepth") >= 0 ? true : false);
            cbxUSMHMouth12.Checked = (columnsToDisplay2.IndexOf("USMHMouth12") >= 0 ? true : false);
            cbxUSMHMouth1.Checked = (columnsToDisplay2.IndexOf("USMHMouth1,") >= 0 ? true : false);
            cbxUSMHMouth2.Checked = (columnsToDisplay2.IndexOf("USMHMouth2") >= 0 ? true : false);
            cbxUSMHMouth3.Checked = (columnsToDisplay2.IndexOf("USMHMouth3") >= 0 ? true : false);
            cbxUSMHMouth4.Checked = (columnsToDisplay2.IndexOf("USMHMouth4") >= 0 ? true : false);
            cbxUSMHMouth5.Checked = (columnsToDisplay2.IndexOf("USMHMouth5") >= 0 ? true : false);
            cbxDSMHAddress.Checked = (columnsToDisplay2.IndexOf("DSMHAddress") >= 0 ? true : false);
            cbxDSMHDepth.Checked = (columnsToDisplay2.IndexOf("DSMHDepth") >= 0 ? true : false);
            cbxDSMHMouth12.Checked = (columnsToDisplay2.IndexOf("DSMHMouth12") >= 0 ? true : false);
            cbxDSMHMouth1.Checked = (columnsToDisplay2.IndexOf("DSMHMouth1,") >= 0 ? true : false);
            cbxDSMHMouth2.Checked = (columnsToDisplay2.IndexOf("DSMHMouth2") >= 0 ? true : false);
            cbxDSMHMouth3.Checked = (columnsToDisplay2.IndexOf("DSMHMouth3") >= 0 ? true : false);
            cbxDSMHMouth4.Checked = (columnsToDisplay2.IndexOf("DSMHMouth4") >= 0 ? true : false);
            cbxDSMHMouth5.Checked = (columnsToDisplay2.IndexOf("DSMHMouth5") >= 0 ? true : false);
            cbxTrafficControl.Checked = (columnsToDisplay2.IndexOf("TrafficControl,") >= 0 ? true : false);
            cbxSiteDetails.Checked = (columnsToDisplay2.IndexOf("SiteDetails") >= 0 ? true : false);
            cbxPipeSizeChange.Checked = (columnsToDisplay2.IndexOf("PipeSizeChange") >= 0 ? true : false);
            cbxStandardBypass.Checked = (columnsToDisplay2.IndexOf("StandardBypass,") >= 0 ? true : false);
            cbxStandardBypassComments.Checked = (columnsToDisplay2.IndexOf("StandardBypassComments") >= 0 ? true : false);
            cbxTrafficControlDetails.Checked = (columnsToDisplay2.IndexOf("TrafficControlDetails") >= 0 ? true : false);
            cbxMeasurementType.Checked = (columnsToDisplay2.IndexOf("MeasurementType") >= 0 ? true : false);
            cbxMeasuredFromMH.Checked = (columnsToDisplay2.IndexOf("MeasurementFromMH") >= 0 ? true : false);
            cbxVideoDoneFromMH.Checked = (columnsToDisplay2.IndexOf("VideoDoneFromMH") >= 0 ? true : false);
            cbxVideoDoneToMH.Checked = (columnsToDisplay2.IndexOf("VideoDoneToMH") >= 0 ? true : false);
            cbxM1MeasurementsTakenBy.Checked = (columnsToDisplay2.IndexOf("M1MeasurementTakenBy") >= 0 ? true : false);
            cbxM2MeasurementsTakenBy.Checked = (columnsToDisplay2.IndexOf("M2MeasurementTakenBy") >= 0 ? true : false);
            cbxDropPipe.Checked = (columnsToDisplay2.IndexOf("DropPipe,") >= 0 ? true : false);
            cbxDropPipeInvertDepth.Checked = (columnsToDisplay2.IndexOf("DropPipeInvertDepth") >= 0 ? true : false);
            cbxCappedLaterals.Checked = (columnsToDisplay2.IndexOf("CappedLaterals") >= 0 ? true : false);
            cbxLineWidthID.Checked = (columnsToDisplay2.IndexOf("LineWithID") >= 0 ? true : false);
            cbxHydrantAddress.Checked = (columnsToDisplay2.IndexOf("HydrantAddress") >= 0 ? true : false);
            cbxHydrantDistanceToInversionMH.Checked = (columnsToDisplay2.IndexOf("DistanceToInversionMH") >= 0 ? true : false);
            cbxHydroWireWithin10FtOfInversionMH.Checked = (columnsToDisplay2.IndexOf("HydroWireWithin10FtOfInversionMH") >= 0 ? true : false);
            cbxSurfaceGrade.Checked = (columnsToDisplay2.IndexOf("SurfaceGrade") >= 0 ? true : false);
            cbxHydroPulley.Checked = (columnsToDisplay2.IndexOf("HydroPulley") >= 0 ? true : false);
            cbxFridgeCart.Checked = (columnsToDisplay2.IndexOf("FridgeCart") >= 0 ? true : false);
            cbx2InchPump.Checked = (columnsToDisplay2.IndexOf("TwoPump") >= 0 ? true : false);

            // Grid's columns
            grdFLNavigator.Columns[2].Visible = (columnsToDisplay.IndexOf(" SectionID,") >= 0 ? true : false);
            if (columnsToDisplay.IndexOf("SectionID") >= 0) grdFLNavigator.Columns[2].Visible = true;
            grdFLNavigator.Columns[3].Visible = (columnsToDisplay.IndexOf("OriginalSectionID") >= 0 ? true : false);
            grdFLNavigator.Columns[4].Visible = (columnsToDisplay.IndexOf("SubArea") >= 0 ? true : false);
            grdFLNavigator.Columns[5].Visible = (columnsToDisplay.IndexOf("Street") >= 0 ? true : false);
            grdFLNavigator.Columns[6].Visible = (columnsToDisplay.Contains(" USMH,") ? true : false);
            grdFLNavigator.Columns[7].Visible = (columnsToDisplay.Contains(" DSMH") ? true : false);
            grdFLNavigator.Columns[8].Visible = (columnsToDisplay.IndexOf("ProposedLiningDate") >= 0 ? true : false);
            grdFLNavigator.Columns[9].Visible = (columnsToDisplay.IndexOf("DeadlineLiningDate") >= 0 ? true : false);
            grdFLNavigator.Columns[10].Visible = (columnsToDisplay.IndexOf("P1Date") >= 0 ? true : false);
            grdFLNavigator.Columns[11].Visible = (columnsToDisplay.IndexOf("M1Date") >= 0 ? true : false);
            grdFLNavigator.Columns[12].Visible = (columnsToDisplay.IndexOf("M2Date") >= 0 ? true : false);
            grdFLNavigator.Columns[13].Visible = (columnsToDisplay.IndexOf("InstallDate") >= 0 ? true : false);
            grdFLNavigator.Columns[14].Visible = (columnsToDisplay.IndexOf("FinalVideoDate") >= 0 ? true : false);
            grdFLNavigator.Columns[15].Visible = (columnsToDisplay.IndexOf("Size_") >= 0 ? true : false);
            grdFLNavigator.Columns[16].Visible = (columnsToDisplay.Contains("ActualLength") ? true : false);
            if (columnsToDisplay.IndexOf(", Length") >= 0) grdFLNavigator.Columns[16].Visible = true;
            grdFLNavigator.Columns[17].Visible = (columnsToDisplay.Contains("Thickness") ? true : false);
            grdFLNavigator.Columns[18].Visible = (columnsToDisplay.IndexOf(" Comments") >= 0 ? true : false);
            grdFLNavigator.Columns[19].Visible = (columnsToDisplay.IndexOf("MapSize") >= 0 ? true : false);
            grdFLNavigator.Columns[20].Visible = (columnsToDisplay.IndexOf("MapLength") >= 0 ? true : false);
            grdFLNavigator.Columns[21].Visible = (columnsToDisplay.Contains("VideoLength") ? true : false);
            grdFLNavigator.Columns[22].Visible = (columnsToDisplay.Contains(" Laterals") ? true : false);
            grdFLNavigator.Columns[23].Visible = (columnsToDisplay.Contains("LiveLaterals") ? true : false);
            grdFLNavigator.Columns[24].Visible = (columnsToDisplay.IndexOf("ClientID") >= 0 ? true : false);
            grdFLNavigator.Columns[25].Visible = (columnsToDisplay.IndexOf("PreFlushDate") >= 0 ? true : false);
            grdFLNavigator.Columns[26].Visible = (columnsToDisplay.IndexOf("PreVideoDate") >= 0 ? true : false);
            grdFLNavigator.Columns[27].Visible = (columnsToDisplay.IndexOf("IssueIdentified") >= 0 ? true : false);
            grdFLNavigator.Columns[28].Visible = (columnsToDisplay.IndexOf("IssueLFS") >= 0 ? true : false);
            grdFLNavigator.Columns[29].Visible = (columnsToDisplay.IndexOf("IssueClient") >= 0 ? true : false);
            grdFLNavigator.Columns[30].Visible = (columnsToDisplay.IndexOf("IssueSales") >= 0 ? true : false);
            grdFLNavigator.Columns[31].Visible = (columnsToDisplay.IndexOf("IssueGivenToClient") >= 0 ? true : false);
            grdFLNavigator.Columns[32].Visible = (columnsToDisplay.IndexOf("IssueInvestigation") >= 0 ? true : false);
            grdFLNavigator.Columns[33].Visible = (columnsToDisplay.IndexOf("IssueResolved") >= 0 ? true : false);
            grdFLNavigator.Columns[34].Visible = (columnsToDisplay.IndexOf("CXIsRemoved") >= 0 ? true : false);
            grdFLNavigator.Columns[35].Visible = (columnsToDisplay.IndexOf("MaterialType") >= 0 ? true : false);
            grdFLNavigator.Columns[36].Visible = (columnsToDisplay.IndexOf("USMHAddress") >= 0 ? true : false);
            grdFLNavigator.Columns[37].Visible = (columnsToDisplay.IndexOf("USMHDepth") >= 0 ? true : false);
            grdFLNavigator.Columns[38].Visible = (columnsToDisplay.IndexOf("USMHMouth12") >= 0 ? true : false);
            grdFLNavigator.Columns[39].Visible = (columnsToDisplay.IndexOf("USMHMouth1,") >= 0 ? true : false);
            grdFLNavigator.Columns[40].Visible = (columnsToDisplay.IndexOf("USMHMouth2") >= 0 ? true : false);
            grdFLNavigator.Columns[41].Visible = (columnsToDisplay.IndexOf("USMHMouth3") >= 0 ? true : false);
            grdFLNavigator.Columns[42].Visible = (columnsToDisplay.IndexOf("USMHMouth4") >= 0 ? true : false);
            grdFLNavigator.Columns[43].Visible = (columnsToDisplay.IndexOf("USMHMouth5") >= 0 ? true : false);
            grdFLNavigator.Columns[44].Visible = (columnsToDisplay.IndexOf("DSMHAddress") >= 0 ? true : false);
            grdFLNavigator.Columns[45].Visible = (columnsToDisplay.IndexOf("DSMHDepth") >= 0 ? true : false);
            grdFLNavigator.Columns[46].Visible = (columnsToDisplay.IndexOf("DSMHMouth12") >= 0 ? true : false);
            grdFLNavigator.Columns[47].Visible = (columnsToDisplay.IndexOf("DSMHMouth1,") >= 0 ? true : false);
            grdFLNavigator.Columns[48].Visible = (columnsToDisplay.IndexOf("DSMHMouth2") >= 0 ? true : false);
            grdFLNavigator.Columns[49].Visible = (columnsToDisplay.IndexOf("DSMHMouth3") >= 0 ? true : false);
            grdFLNavigator.Columns[50].Visible = (columnsToDisplay.IndexOf("DSMHMouth4") >= 0 ? true : false);
            grdFLNavigator.Columns[51].Visible = (columnsToDisplay.IndexOf("DSMHMouth5") >= 0 ? true : false);
            grdFLNavigator.Columns[52].Visible = (columnsToDisplay.IndexOf("TrafficControl,") >= 0 ? true : false);
            grdFLNavigator.Columns[53].Visible = (columnsToDisplay.IndexOf("SiteDetails") >= 0 ? true : false);
            grdFLNavigator.Columns[54].Visible = (columnsToDisplay.IndexOf("PipeSizeChange") >= 0 ? true : false);
            grdFLNavigator.Columns[55].Visible = (columnsToDisplay.IndexOf("StandardBypass,") >= 0 ? true : false);
            grdFLNavigator.Columns[56].Visible = (columnsToDisplay.IndexOf("StandardBypassComments") >= 0 ? true : false);
            grdFLNavigator.Columns[57].Visible = (columnsToDisplay.IndexOf("TrafficControlDetails") >= 0 ? true : false);
            grdFLNavigator.Columns[58].Visible = (columnsToDisplay.IndexOf("MeasurementType") >= 0 ? true : false);
            grdFLNavigator.Columns[59].Visible = (columnsToDisplay.IndexOf("MeasurementFromMH") >= 0 ? true : false);
            grdFLNavigator.Columns[60].Visible = (columnsToDisplay.IndexOf("VideoDoneFromMH") >= 0 ? true : false);
            grdFLNavigator.Columns[61].Visible = (columnsToDisplay.IndexOf("VideoDoneToMH") >= 0 ? true : false);
            grdFLNavigator.Columns[62].Visible = (columnsToDisplay.IndexOf("M1MeasurementTakenBy") >= 0 ? true : false);
            grdFLNavigator.Columns[63].Visible = (columnsToDisplay.IndexOf("M2MeasurementTakenBy") >= 0 ? true : false);
            grdFLNavigator.Columns[64].Visible = (columnsToDisplay.IndexOf("DropPipe,") >= 0 ? true : false);
            grdFLNavigator.Columns[65].Visible = (columnsToDisplay.IndexOf("DropPipeInvertDepth") >= 0 ? true : false);
            grdFLNavigator.Columns[66].Visible = (columnsToDisplay.IndexOf("CappedLaterals") >= 0 ? true : false);
            grdFLNavigator.Columns[67].Visible = (columnsToDisplay.IndexOf("LineWithID") >= 0 ? true : false);
            grdFLNavigator.Columns[68].Visible = (columnsToDisplay.IndexOf("HydrantAddress") >= 0 ? true : false);
            grdFLNavigator.Columns[69].Visible = (columnsToDisplay.IndexOf("DistanceToInversionMH") >= 0 ? true : false);
            grdFLNavigator.Columns[70].Visible = (columnsToDisplay.IndexOf("HydroWireWithin10FtOfInversionMH") >= 0 ? true : false);
            grdFLNavigator.Columns[71].Visible = (columnsToDisplay.IndexOf("SurfaceGrade") >= 0 ? true : false);
            grdFLNavigator.Columns[72].Visible = (columnsToDisplay.IndexOf("HydroPulley") >= 0 ? true : false);
            grdFLNavigator.Columns[73].Visible = (columnsToDisplay.IndexOf("FridgeCart") >= 0 ? true : false);
            grdFLNavigator.Columns[74].Visible = (columnsToDisplay.IndexOf("TwoPump") >= 0 ? true : false);
            grdFLNavigator.Columns[75].Visible = (columnsToDisplay.IndexOf("SixBypass") >= 0 ? true : false);
            grdFLNavigator.Columns[76].Visible = (columnsToDisplay.IndexOf("Scaffolding") >= 0 ? true : false);
            grdFLNavigator.Columns[77].Visible = (columnsToDisplay.IndexOf("WinchExtention") >= 0 ? true : false);
            grdFLNavigator.Columns[78].Visible = (columnsToDisplay.IndexOf("ExtraGenerator") >= 0 ? true : false);
            grdFLNavigator.Columns[79].Visible = (columnsToDisplay.IndexOf("GreyCableExtension") >= 0 ? true : false);
            grdFLNavigator.Columns[80].Visible = (columnsToDisplay.IndexOf("EasementMats") >= 0 ? true : false);
            grdFLNavigator.Columns[81].Visible = (columnsToDisplay.IndexOf("RampRequired") >= 0 ? true : false);
            grdFLNavigator.Columns[82].Visible = (columnsToDisplay.IndexOf("CameraSkid") >= 0 ? true : false);
            grdFLNavigator.Columns[83].Visible = (columnsToDisplay.IndexOf("RoboticPrepCompleted") >= 0 ? true : false);
            grdFLNavigator.Columns[84].Visible = (columnsToDisplay.IndexOf("RoboticPrepCompletedDate") >= 0 ? true : false);
            grdFLNavigator.Columns[86].Visible = false;

            if (ddlCondition1.SelectedItem.Text == "Brushed" || ddlCondition1.SelectedItem.Text == "Opened")
            {
                grdFLNavigator.Columns[86].Visible = true;
            }
        }
        private void RestoreNavigatorState()
        {
            // Search condition 1
            // Columns To Display
            string columnsToDisplay = Request.QueryString["columns_to_display"];

            // Search condition 1
            // ... For Condition
            odsViewForDisplayList.DataBind();
            ddlCondition1.DataSourceID = "odsViewForDisplayList";
            ddlCondition1.DataValueField = "ConditionID";
            ddlCondition1.DataTextField = "Name";
            ddlCondition1.DataBind();
            ddlCondition1.SelectedValue = Request.QueryString["search_ddlCondition1"];

            // ... For text for search
            tbxCondition1.Text = Request.QueryString["search_tbxCondition1"];

            // ... ForView
            int companyId = Int32.Parse(hdfCompanyId.Value.Trim());
            string workType = hdfWorkType.Value;
            int loginId = Convert.ToInt32(Session["loginID"]);
            string viewTypeGlobal = "";
            string viewTypePersonal = "Personal";

            // Global Views check
            if (Convert.ToBoolean(Session["sgLFS_GLOBALVIEWS_VIEW"]))
            {
                viewTypeGlobal = "Global";
            }

            WorkViewList workViewList = new WorkViewList();
            workViewList.LoadAndAddItem(workType, viewTypeGlobal, viewTypePersonal, loginId, companyId);
            ddlView.DataSource = workViewList.Table;
            ddlView.DataValueField = "ViewID";
            ddlView.DataTextField = "Name";
            ddlView.DataBind();
            ddlView.SelectedValue = Request.QueryString["search_ddlView"];

            //Other values
            //... For SortBy
            odsSortByList.DataBind();
            ddlSortBy.DataSourceID = "odsSortByList";
            ddlSortBy.DataValueField = "SortID";
            ddlSortBy.DataTextField = "Name";
            ddlSortBy.DataBind();
            ddlSortBy.SelectedValue = Request.QueryString["search_sort_by"];

            // ... For BtnOrigin
            hdfBtnOrigin.Value = Request.QueryString["btn_origin"];
        }
        private void RestoreNavigatorState()
        {
            // Search condition 1
            // Columns To Display
            string columnsToDisplay = Request.QueryString["columns_to_display"];
            string columnsToDisplay2 = Request.QueryString["columns_to_display2"];

            // Search condition
            // ... For Condition 1
            odsViewForDisplayList.DataBind();
            ddlCondition1.DataSourceID = "odsViewForDisplayList";
            ddlCondition1.DataValueField = "ConditionID";
            ddlCondition1.DataTextField = "Name";
            ddlCondition1.DataBind();
            ddlCondition1.SelectedValue = Request.QueryString["search_ddlCondition1"];

            tbxCondition1.Text = Request.QueryString["search_tbxCondition1"];
            ddlOperator1.SelectedValue = Request.QueryString["search_ddlOperator1"];

            // ... For Condition 2
            odsViewForDisplayList2.DataBind();
            ddlCondition2.DataSourceID = "odsViewForDisplayList2";
            ddlCondition2.DataValueField = "ConditionID";
            ddlCondition2.DataTextField = "Name";
            ddlCondition2.DataBind();
            ddlCondition2.SelectedValue = Request.QueryString["search_ddlCondition2"];
            tbxCondition2.Text = Request.QueryString["search_tbxCondition2"];
            ddlOperator2.SelectedValue = Request.QueryString["search_ddlOperator2"];

            // ... For View
            int companyId = Int32.Parse(hdfCompanyId.Value.Trim());
            string workType = hdfWorkType.Value;
            int loginId = Convert.ToInt32(Session["loginID"]);
            string viewTypeGlobal = "";
            string viewTypePersonal = "Personal";

            // Global Views check
            if (Convert.ToBoolean(Session["sgLFS_GLOBALVIEWS_VIEW"]))
            {
                viewTypeGlobal = "Global";
            }

            WorkViewList workViewList = new WorkViewList();
            workViewList.LoadAndAddItem(workType, viewTypeGlobal, viewTypePersonal, loginId, companyId);
            ddlView.DataSource = workViewList.Table;
            ddlView.DataValueField = "ViewID";
            ddlView.DataTextField = "Name";
            ddlView.DataBind();
            ddlView.SelectedValue = Request.QueryString["search_ddlView"];

            //Other values
            //... For SortBy
            odsSortByList.DataBind();
            ddlSortBy.DataSourceID = "odsSortByList";
            ddlSortBy.DataValueField = "SortID";
            ddlSortBy.DataTextField = "Name";
            ddlSortBy.DataBind();
            ddlSortBy.SelectedValue = Request.QueryString["search_sort_by"];

            // ... For BtnOrigin
            hdfBtnOrigin.Value = Request.QueryString["btn_origin"];

            cbxIdSection.Checked = (columnsToDisplay2.IndexOf(" SectionID,") >= 0 ? true : false);
            cbxOldCWPID.Checked = (columnsToDisplay2.IndexOf("OriginalSectionID") >= 0 ? true : false);
            cbxSubArea.Checked = (columnsToDisplay2.IndexOf("SubArea") >= 0 ? true : false);
            cbxStreet.Checked = (columnsToDisplay2.IndexOf("Street") >= 0 ? true : false);
            cbxUsmh.Checked = (columnsToDisplay2.IndexOf(" USMH,") >= 0 ? true : false);
            cbxDsmh.Checked = (columnsToDisplay2.IndexOf(" DSMH") >= 0 ? true : false);
            cbxProposedLiningDate.Checked = (columnsToDisplay2.IndexOf("ProposedLiningDate") >= 0 ? true : false);
            cbxDeadlineLiningDate.Checked = (columnsToDisplay2.IndexOf("DeadlineLiningDate") >= 0 ? true : false);
            cbxP1Date.Checked = (columnsToDisplay2.IndexOf("P1Date") >= 0 ? true : false);
            cbxM1Date.Checked = (columnsToDisplay2.IndexOf("M1Date") >= 0 ? true : false);
            cbxM2Date.Checked = (columnsToDisplay2.IndexOf("M2Date") >= 0 ? true : false);
            cbxInstallDate.Checked = (columnsToDisplay2.IndexOf("InstallDate") >= 0 ? true : false);
            cbxFinalVideoDate.Checked = (columnsToDisplay2.IndexOf("FinalVideoDate") >= 0 ? true : false);
            cbxConfirmedSize.Checked = (columnsToDisplay2.IndexOf("Size_") >= 0 ? true : false);
            cbxActualLength.Checked = (columnsToDisplay2.IndexOf("ActualLength") >= 0 ? true : false);
            cbxComments.Checked = (columnsToDisplay2.IndexOf(" Comments") >= 0 ? true : false);
            cbxMapSize.Checked = (columnsToDisplay2.IndexOf("MapSize") >= 0 ? true : false);
            cbxMapLength.Checked = (columnsToDisplay2.IndexOf("MapLength") >= 0 ? true : false);
            cbxVideoLength.Checked = (columnsToDisplay2.IndexOf("VideoLength") >= 0 ? true : false);
            cbxLaterals.Checked = (columnsToDisplay2.IndexOf(" Laterals") >= 0 ? true : false);
            cbxLiveLaterals.Checked = (columnsToDisplay2.IndexOf("LiveLaterals") >= 0 ? true : false);
            cbxClientID.Checked = (columnsToDisplay2.IndexOf("ClientID") >= 0 ? true : false);
            cbxPreFlushDate.Checked = (columnsToDisplay2.IndexOf("PreFlushDate") >= 0 ? true : false);
            cbxPreVideoDate.Checked = (columnsToDisplay2.IndexOf("PreVideoDate") >= 0 ? true : false);
            cbxIssueIdentified.Checked = (columnsToDisplay2.IndexOf("IssueIdentified") >= 0 ? true : false);
            cbxLFSIssue.Checked = (columnsToDisplay2.IndexOf("IssueLFS") >= 0 ? true : false);
            cbxClientIssue.Checked = (columnsToDisplay2.IndexOf("IssueClient") >= 0 ? true : false);
            cbxSalesIssue.Checked = (columnsToDisplay2.IndexOf("IssueSales") >= 0 ? true : false);
            cbxIssueGivenToClient.Checked = (columnsToDisplay2.IndexOf("IssueGivenToClient") >= 0 ? true : false);
            cbxIssueInvestigation.Checked = (columnsToDisplay2.IndexOf("IssueInvestigation") >= 0 ? true : false);
            cbxIssueResolved.Checked = (columnsToDisplay2.IndexOf("IssueResolved") >= 0 ? true : false);
            cbxCXIsRemoved.Checked = (columnsToDisplay2.IndexOf("CXIsRemoved") >= 0 ? true : false);
            cbxMaterial.Checked = (columnsToDisplay2.IndexOf("MaterialType") >= 0 ? true : false);
            cbxUSMHAddress.Checked = (columnsToDisplay2.IndexOf("USMHAddress") >= 0 ? true : false);
            cbxUSMHDepth.Checked = (columnsToDisplay2.IndexOf("USMHDepth") >= 0 ? true : false);
            cbxUSMHMouth12.Checked = (columnsToDisplay2.IndexOf("USMHMouth12") >= 0 ? true : false);
            cbxUSMHMouth1.Checked = (columnsToDisplay2.IndexOf("USMHMouth1,") >= 0 ? true : false);
            cbxUSMHMouth2.Checked = (columnsToDisplay2.IndexOf("USMHMouth2") >= 0 ? true : false);
            cbxUSMHMouth3.Checked = (columnsToDisplay2.IndexOf("USMHMouth3") >= 0 ? true : false);
            cbxUSMHMouth4.Checked = (columnsToDisplay2.IndexOf("USMHMouth4") >= 0 ? true : false);
            cbxUSMHMouth5.Checked = (columnsToDisplay2.IndexOf("USMHMouth5") >= 0 ? true : false);
            cbxDSMHAddress.Checked = (columnsToDisplay2.IndexOf("DSMHAddress") >= 0 ? true : false);
            cbxDSMHDepth.Checked = (columnsToDisplay2.IndexOf("DSMHDepth") >= 0 ? true : false);
            cbxDSMHMouth12.Checked = (columnsToDisplay2.IndexOf("DSMHMouth12") >= 0 ? true : false);
            cbxDSMHMouth1.Checked = (columnsToDisplay2.IndexOf("DSMHMouth1,") >= 0 ? true : false);
            cbxDSMHMouth2.Checked = (columnsToDisplay2.IndexOf("DSMHMouth2") >= 0 ? true : false);
            cbxDSMHMouth3.Checked = (columnsToDisplay2.IndexOf("DSMHMouth3") >= 0 ? true : false);
            cbxDSMHMouth4.Checked = (columnsToDisplay2.IndexOf("DSMHMouth4") >= 0 ? true : false);
            cbxDSMHMouth5.Checked = (columnsToDisplay2.IndexOf("DSMHMouth5") >= 0 ? true : false);
            cbxTrafficControl.Checked = (columnsToDisplay2.IndexOf("TrafficControl,") >= 0 ? true : false);
            cbxSiteDetails.Checked = (columnsToDisplay2.IndexOf("SiteDetails") >= 0 ? true : false);
            cbxPipeSizeChange.Checked = (columnsToDisplay2.IndexOf("PipeSizeChange") >= 0 ? true : false);
            cbxStandardBypass.Checked = (columnsToDisplay2.IndexOf("StandardBypass,") >= 0 ? true : false);
            cbxStandardBypassComments.Checked = (columnsToDisplay2.IndexOf("StandardBypassComments") >= 0 ? true : false);
            cbxTrafficControlDetails.Checked = (columnsToDisplay2.IndexOf("TrafficControlDetails") >= 0 ? true : false);
            cbxMeasurementType.Checked = (columnsToDisplay2.IndexOf("MeasurementType") >= 0 ? true : false);
            cbxMeasuredFromMH.Checked = (columnsToDisplay2.IndexOf("MeasurementFromMH") >= 0 ? true : false);
            cbxVideoDoneFromMH.Checked = (columnsToDisplay2.IndexOf("VideoDoneFromMH") >= 0 ? true : false);
            cbxVideoDoneToMH.Checked = (columnsToDisplay2.IndexOf("VideoDoneToMH") >= 0 ? true : false);
            cbxM1MeasurementsTakenBy.Checked = (columnsToDisplay2.IndexOf("M1MeasurementTakenBy") >= 0 ? true : false);
            cbxM2MeasurementsTakenBy.Checked = (columnsToDisplay2.IndexOf("M2MeasurementTakenBy") >= 0 ? true : false);
            cbxDropPipe.Checked = (columnsToDisplay2.IndexOf("DropPipe,") >= 0 ? true : false);
            cbxDropPipeInvertDepth.Checked = (columnsToDisplay2.IndexOf("DropPipeInvertDepth") >= 0 ? true : false);
            cbxCappedLaterals.Checked = (columnsToDisplay2.IndexOf("CappedLaterals") >= 0 ? true : false);
            cbxLineWidthID.Checked = (columnsToDisplay2.IndexOf("LineWithID") >= 0 ? true : false);
            cbxHydrantAddress.Checked = (columnsToDisplay2.IndexOf("HydrantAddress") >= 0 ? true : false);
            cbxHydrantDistanceToInversionMH.Checked = (columnsToDisplay2.IndexOf("DistanceToInversionMH") >= 0 ? true : false);
            cbxHydroWireWithin10FtOfInversionMH.Checked = (columnsToDisplay2.IndexOf("HydroWireWithin10FtOfInversionMH") >= 0 ? true : false);
            cbxSurfaceGrade.Checked = (columnsToDisplay2.IndexOf("SurfaceGrade") >= 0 ? true : false);
            cbxHydroPulley.Checked = (columnsToDisplay2.IndexOf("HydroPulley") >= 0 ? true : false);
            cbxFridgeCart.Checked = (columnsToDisplay2.IndexOf("FridgeCart") >= 0 ? true : false);
            cbx2InchPump.Checked = (columnsToDisplay2.IndexOf("TwoPump") >= 0 ? true : false);
        }