public ProjectAddSectionsTDS.ProjectAddSectionsTempDataTable GetRemove()
        {
            projectAddSectionsTemp = (ProjectAddSectionsTDS.ProjectAddSectionsTempDataTable)Session["projectAddSectionsTempDummy"];
            if (projectAddSectionsTemp == null)
            {
                projectAddSectionsTemp = (ProjectAddSectionsTDS.ProjectAddSectionsTempDataTable)Session["projectAddSectionsTemp"];
            }

            return projectAddSectionsTemp;
        }
        private void RemoveEmptyFix(GridView grdView)
        {
            if (grdView.Rows.Count == 0)
            {
                ProjectAddSectionsTDS.ProjectAddSectionsTempDataTable dt = new ProjectAddSectionsTDS.ProjectAddSectionsTempDataTable();
                dt.AddProjectAddSectionsTempRow(0, 0, "", "", "", "", false, false, false, "", false, false, "", "", "", false, false, false, false, false, "", "", "", "", "", -1, "", "", "", "", "", -1, "","","","","","","","","","",-1, "","","","","",-1, "","","","","",-1,-1, "", "", false, false);
                Session["projectAddSectionsTempDummy"] = dt;

                grdView.DataBind();
            }

            // normally executes at all postbacks
            if (grdView.Rows.Count == 1)
            {
                ProjectAddSectionsTDS.ProjectAddSectionsTempDataTable dt = (ProjectAddSectionsTDS.ProjectAddSectionsTempDataTable)Session["projectAddSectionsTempDummy"];
                if (dt != null)
                {
                    // hide row
                    grdView.Rows[0].Visible = false;
                    grdView.Rows[0].Controls.Clear();
                }
            }
        }
        // ////////////////////////////////////////////////////////////////////////
        // INITIAL EVENTS
        //
        protected void Page_Load(object sender, EventArgs e)
        {
            // Register client scripts
            this.RegisterClientScripts();

            if (!IsPostBack)
            {
                // 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 project_add_sections.aspx");
                }

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

                if ((string)Request.QueryString["work_type"] == "Full Length Lining")
                {
                    if (!(Convert.ToBoolean(Session["sgLFS_CWP_FULLLENGTHLINING_ADD"])))
                    {
                        Response.Redirect("./../../error_page.aspx?error=" + "You are not authorized to view this page. Contact your system administrator.");
                    }
                }

                if ((string)Request.QueryString["work_type"] == "Junction Lining")
                {
                    if (!(Convert.ToBoolean(Session["sgLFS_CWP_JUNCTIONLINING_ADD"])))
                    {
                        Response.Redirect("./../../error_page.aspx?error=" + "You are not authorized to view this page. Contact your system administrator.");
                    }
                }

                if ((string)Request.QueryString["work_type"] == "Point Repairs")
                {
                    if (!(Convert.ToBoolean(Session["sgLFS_CWP_POINTREPAIRS_ADD"])))
                    {
                        Response.Redirect("./../../error_page.aspx?error=" + "You are not authorized to view this page. Contact your system administrator.");
                    }
                }

                if ((string)Request.QueryString["work_type"] == "Manhole Rehabilitation")
                {
                    if (!(Convert.ToBoolean(Session["sgLFS_CWP_MANHOLEREHABILITATION_ADD"])))
                    {
                        Response.Redirect("./../../error_page.aspx?error=" + "You are not authorized to view this page. Contact your system administrator.");
                    }
                }

                // Tag Page
                TagPage();

                // Prepare initial data
                Session.Remove("projectAddSectionsNew");
                Session.Remove("projectAddSectionsNewDummy");
                Session.Remove("projectAddSectionsSearch");
                Session.Remove("projectAddSectionsSearchDummy");
                Session.Remove("projectAddSectionsTemp");
                Session.Remove("projectAddSectionsTempDummy");

                // Initialize viewstate variables
                ViewState["StepFrom"] = "Out";

                // If coming from
                // ... ra_navigator.aspx, ra_navigator2.aspx, jl_navigator.aspx, jl_navigator2.aspx, project_sections_navigator.aspx, project_sections_navigator2.aspx, fl_navigator.aspx, fl_navigator2.aspx, ra_lining_plan.aspx, fl_edit.aspx, fl_summary.aspx, ra_edit.aspx, ra_summary.aspx, flat_section_jl_summary.aspx, flat_section_jl_edit.aspx, flat_section_jls_summary.aspx, flat_section_jls_edit.aspx, jl_lining_plan.aspx, pr_navigator.aspx, pr_navigator2.aspx, pr_summay.aspx, pr_edit.aspx, pr_lining_plan, mr_navigator.aspx, mr_navigator2.aspx, mr_edit.aspx, mr_summary.aspx
                if ((Request.QueryString["source_page"] == "ra_navigator.aspx") || (Request.QueryString["source_page"] == "ra_navigator2.aspx") || (Request.QueryString["source_page"] == "jl_navigator.aspx") || (Request.QueryString["source_page"] == "jl_navigator2.aspx") || (Request.QueryString["source_page"] == "project_sections_navigator.aspx") || (Request.QueryString["source_page"] == "project_sections_navigator2.aspx") || (Request.QueryString["source_page"] == "fl_navigator.aspx") || (Request.QueryString["source_page"] == "fl_navigator2.aspx") || (Request.QueryString["source_page"] == "ra_lining_plan.aspx") || (Request.QueryString["source_page"] == "fl_edit.aspx") || (Request.QueryString["source_page"] == "fl_summary.aspx") || (Request.QueryString["source_page"] == "ra_edit.aspx") || (Request.QueryString["source_page"] == "ra_summary.aspx") || (Request.QueryString["source_page"] == "flat_section_jl_summary.aspx") || (Request.QueryString["source_page"] == "flat_section_jl_edit.aspx") || (Request.QueryString["source_page"] == "flat_section_jls_summary.aspx") || (Request.QueryString["source_page"] == "flat_section_jls_edit.aspx") || (Request.QueryString["source_page"] == "jl_lining_plan.aspx") || (Request.QueryString["source_page"] == "pr_navigator.aspx") || (Request.QueryString["source_page"] == "pr_navigator2.aspx") || (Request.QueryString["source_page"] == "pr_summary.aspx") || (Request.QueryString["source_page"] == "pr_edit.aspx") || (Request.QueryString["source_page"] == "pr_lining_plan.aspx") || (Request.QueryString["source_page"] == "mr_navigator.aspx") || (Request.QueryString["source_page"] == "mr_navigator2.aspx")  || (Request.QueryString["source_page"] == "mr_edit.aspx")  || (Request.QueryString["source_page"] == "mr_summary.aspx"))
                {
                    // ... Initialize tables
                    projectAddSectionsNew = new ProjectAddSectionsTDS.ProjectAddSectionsNewDataTable();
                    projectAddSectionsSearch = new ProjectAddSectionsTDS.ProjectAddSectionsSearchDataTable();
                    projectAddSectionsTemp = new ProjectAddSectionsTDS.ProjectAddSectionsTempDataTable();

                    // ... Store tables
                    Session["projectAddSectionsNew"] = projectAddSectionsNew;
                    Session["projectAddSectionsSearch"] = projectAddSectionsSearch;
                    Session["projectAddSectionsTemp"] = projectAddSectionsTemp;
                }

                // StepSection1In
                wzSections.ActiveStepIndex = 0;
                StepBeginIn();
            }
            else
            {
                // Restore tables
                projectAddSectionsNew = (ProjectAddSectionsTDS.ProjectAddSectionsNewDataTable) Session["projectAddSectionsNew"];
                projectAddSectionsSearch = (ProjectAddSectionsTDS.ProjectAddSectionsSearchDataTable)Session["projectAddSectionsSearch"];
                projectAddSectionsTemp = (ProjectAddSectionsTDS.ProjectAddSectionsTempDataTable)Session["projectAddSectionsTemp"];
            }

            // control for postback
            hdfTag.Value = DateTime.Now.ToLongTimeString();
        }