/// <summary>
 /// InitData
 /// </summary>
 protected override void InitData()
 {
     _data = new AddManholeTDS();
 }
        // ////////////////////////////////////////////////////////////////////////
        // INITIAL 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_ADD"])))
                {
                    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 add_manholes.aspx");
                }

                // Tag Page
                TagPage();

                // Prepare initial data
                Session.Remove("addManholeNew");
                Session.Remove("addManholeNewDummy");

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

                // If coming from
                // ... mr_navigator.aspx, mr_navigator2.aspx, mr_edit.aspx, mr_summary.aspx
                if ((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"))
                {
                    // ... Store datasets
                    addManholeTDS = new AddManholeTDS();
                    Session["addManholeTDS"] = addManholeTDS;
                    Session["addManholeNew"] = addManholeTDS.AddManholeNew;

                    // StepSection1In
                    wizard.ActiveStepIndex = 0;
                    StepBeginIn();
                }

                // ...  for the client
                int companyId = Int32.Parse(hdfCompanyId.Value);
                CompaniesList companiesList = new CompaniesList();
                companiesList.LoadAndAddItem(-1, "(Select a client)", companyId);
                ddlClient.DataSource = companiesList.Table;
                ddlClient.DataValueField = "COMPANIES_ID";
                ddlClient.DataTextField = "Name";
                ddlClient.DataBind();

                if (Request.QueryString["client_id"] != null)
                {
                    ddlClient.SelectedValue = Request.QueryString["client_id"];

                    // ... for project
                    ProjectList projectList = new ProjectList();
                    projectList.LoadProjectsAndAddItem(-1, "(All)", int.Parse(ddlClient.SelectedValue));
                    ddlProject.DataSource = projectList.Table;
                    ddlProject.DataValueField = "ProjectID";
                    ddlProject.DataTextField = "Name";
                    ddlProject.DataBind();
                    ddlProject.SelectedValue = Request.QueryString["project_id"];
                }
                else
                {
                    ddlClient.SelectedIndex = 0;

                    // ... for project
                    ProjectList projectList = new ProjectList();
                    projectList.LoadProjectsAndAddItem(-1, "(Select a project)", -1);
                    ddlProject.DataSource = projectList.Table;
                    ddlProject.DataValueField = "ProjectID";
                    ddlProject.DataTextField = "Name";
                    ddlProject.DataBind();
                    ddlProject.SelectedIndex = 0;
                }

                // StepSection1In
                wizard.ActiveStepIndex = 0;
                StepBeginIn();
            }
            else
            {
                // Restore datasets
                addManholeTDS = (AddManholeTDS)Session["addManholeTDS"];

                // Store
                Session["addManholeNew"] = addManholeTDS.AddManholeNew;
            }

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