protected void btnbSearch_Click(object sender, EventArgs e)
        {
            if (Page.IsValid)
            {
                string url = "";

                // Delete store data
                Session.Contents.Remove("jlinerNavigatorTDS");

                // Get data from DA gateway
                jlinerNavigatorTDS = SubmitSearch();

                // Show results
                if (jlinerNavigatorTDS.JlinerNavigator.Rows.Count > 0)
                {
                    // ... Store data
                    Session["jlinerNavigatorTDS"] = jlinerNavigatorTDS;

                    // ... Go to the results page
                    url = "./jliner_navigator2.aspx?source_page=jliner_navigator2.aspx&client=" + hdfCurrentClient.Value + GetNavigatorState();
                }
                else
                {
                    // ... Go to the search page
                    url = "./jliner_navigator.aspx?source_page=jliner_navigator2.aspx&client=" + hdfCurrentClient.Value + GetNavigatorState() + "&no_results=yes";
                }

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

            if (!IsPostBack)
            {
                // Security check
                if (!Convert.ToBoolean(Session["sgLFS_APP_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"] == null))
                {
                    Response.Redirect("./../../error_page.aspx?error=" + "Invalid query string in jliner_navigator2.aspx");
                }

                // Tag page
                hdfCurrentClient.Value = (string)Request.QueryString["client"];

                // ... for the ddl Sub areas
                SectionSubArea sectionSubArea = new SectionSubArea();
                sectionSubArea.LoadAndAddItem(int.Parse(hdfCurrentClient.Value), "(All)");
                ddlSubArea.DataSource = sectionSubArea.Table;
                ddlSubArea.DataValueField = "SubArea";
                ddlSubArea.DataTextField = "SubArea";
                ddlSubArea.DataBind();

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

                    jlinerNavigatorTDS = (JlinerNavigatorTDS)Session["jlinerNavigatorTDS"];
                }

                // ... flat_section_jliner_edit.aspx or flat_section_jliner_summary.aspx  or jliner_delete.aspx
                if ((Request.QueryString["source_page"] == "flat_section_jliner_edit.aspx") || (Request.QueryString["source_page"] == "flat_section_jliner_summary.aspx") || (Request.QueryString["source_page"] == "jliner_delete.aspx"))
                {
                    RestoreNavigatorState();

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

                        // ... Search data with updates
                        jlinerNavigatorTDS = SubmitSearch();

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

                // ... jliner_delete.aspx
                if (Request.QueryString["source_page"] == "jliner_delete.aspx")
                {
                    if (jlinerNavigatorTDS.JlinerNavigator.Rows.Count == 0)
                    {
                        string url = "./jliner_navigator.aspx?source_page=jliner_navigator2.aspx&client=" + hdfCurrentClient.Value + GetNavigatorState() + "&no_results=no";
                        Response.Redirect(url);
                    }
                }

                // Prepare initial data
                // ...  for the client
                int companyId = Int32.Parse(Session["companyID"].ToString());
                CompaniesGateway companiesGateway = new CompaniesGateway();
                companiesGateway.LoadByCompaniesId(int.Parse(hdfCurrentClient.Value), companyId);

                TextBox tbxCurrentClient = (TextBox)tkrpbLeftMenuCurrentClient.FindItemByValue("mCurrentClient").FindControl("tbxCurrentClient");
                tbxCurrentClient.Text = companiesGateway.GetName(int.Parse(hdfCurrentClient.Value));
                hdfClientName.Value = tbxCurrentClient.Text;

                // ... for the grid
                grdJlinerNavigator.DataSource = jlinerNavigatorTDS.JlinerNavigator;
                grdJlinerNavigator.DataBind();

                // ... for the total rows
                if (jlinerNavigatorTDS.JlinerNavigator.Rows.Count > 0)
                {
                    grdJlinerNavigator.Caption = String.Format("<table border='0' width='100%' cellpadding='0' cellspacing='0' style='font-weight: bold; font-size: 11px; color: #2F82C7; font-family: 'Microsoft Sans Serif';'><tr><td>Total Rows: {0}</td></tr></table>", jlinerNavigatorTDS.JlinerNavigator.Rows.Count);
                    grdJlinerNavigator.ShowHeader = true;
                }
                else
                {
                    grdJlinerNavigator.ShowHeader = false;
                }
            }
            else
            {
                // Restore TDS
                jlinerNavigatorTDS = (JlinerNavigatorTDS)Session["jlinerNavigatorTDS"];

                // ... for the total rows
                if (jlinerNavigatorTDS.JlinerNavigator.Rows.Count > 0)
                {
                    grdJlinerNavigator.Caption = String.Format("<table border='0' width='100%' cellpadding='0' cellspacing='0' style='font-weight: bold; font-size: 11px; color: #2F82C7; font-family: 'Microsoft Sans Serif';'><tr><td>Total Rows: {0}</td></tr></table>", jlinerNavigatorTDS.JlinerNavigator.Rows.Count);
                    grdJlinerNavigator.ShowHeader = true;
                }
                else
                {
                    grdJlinerNavigator.ShowHeader = false;
                }
            }
        }
 /// <summary>
 /// InitData
 /// </summary>
 protected override void InitData()
 {
     _data = new JlinerNavigatorTDS();
 }