protected void btnSubmit_Click(object sender, System.EventArgs e) { if (Page.IsValid && (tbxSearch.Text.Trim() != "")) { //--- Get data from database gateway tdsLfsRecordForNavigator = this.SubmitSearch(); Session["tdsLfsRecordForNavigator"] = tdsLfsRecordForNavigator; //--- Show results if (tdsLfsRecordForNavigator.NAVIGATOR.DefaultView.Count > 0) { //--- ... Yes results //--- ... Store navigator state Session["ddlSearchSelectedIndex"] = ddlSearch.SelectedIndex; Session["tbxSearchText"] = tbxSearch.Text; Session["lblHintVisible"] = lblHint.Visible; Session["lblHintText"] = lblHint.Text; //--- ... Go to results page Response.Redirect("navigator2.aspx?search_results=true"); } else { //--- ... No results pNoResults.Visible = true; lblResults.Visible = true; } } }
// // GetNextId // public static Guid GetNextId(TDSLFSRecordForNavigator tdsLfsRecordForNavigator, Guid currentId) { Guid nextId = currentId; for (int i=0; i < tdsLfsRecordForNavigator.NAVIGATOR.DefaultView.Count; i++) { if ((Guid)tdsLfsRecordForNavigator.NAVIGATOR.DefaultView[i]["ID"] == currentId) { if (i == tdsLfsRecordForNavigator.NAVIGATOR.DefaultView.Count-1) { nextId = currentId; } else { nextId = (Guid)tdsLfsRecordForNavigator.NAVIGATOR.DefaultView[i+1]["ID"]; } break; } } return nextId; }
/////////////////////////////////////////////////////////////////////////// /// METHODS /// // // GetPreviousId // public static Guid GetPreviousId(TDSLFSRecordForNavigator tdsLfsRecordForNavigator, Guid currentId) { Guid prevId = currentId; for (int i=0; i < tdsLfsRecordForNavigator.NAVIGATOR.DefaultView.Count; i++) { if ((Guid)tdsLfsRecordForNavigator.NAVIGATOR.DefaultView[i]["ID"] == currentId) { if (i == 0) { prevId = currentId; } else { prevId = (Guid)tdsLfsRecordForNavigator.NAVIGATOR.DefaultView[i-1]["ID"]; } break; } } return prevId; }
// // GetRecordsByCompanyIdUsmhTargetPage() // // Returns target page's records that match an usmh (where usmh like usmh%) ordered by usmh // public TDSLFSRecordForNavigator GetRecordsByCompanyIdUsmhTargetPage(int companyId, string usmh, string targetPage) { SqlConnection connection = new SqlConnection(ConnectionString); string commandText = ""; switch(targetPage) { case "view_all.aspx": commandText = "SELECT LFS_MASTER_AREA.ID, LFS_MASTER_AREA.COMPANY_ID, LFS_MASTER_AREA.RecordID, LFS_MASTER_AREA.COMPANIES_ID, COMPANIES.NAME, LFS_MASTER_AREA.Street, LFS_MASTER_AREA.USMH, LFS_MASTER_AREA.DSMH, LFS_MASTER_AREA.P1Date, LFS_MASTER_AREA.M1Date, LFS_MASTER_AREA.M2Date, LFS_MASTER_AREA.InstallDate, LFS_MASTER_AREA.Deleted, LFS_MASTER_AREA.Archived, CAST (0 AS BIT) AS Selected FROM LFS_MASTER_AREA INNER JOIN LFS_RESOURCES_COMPANIES AS COMPANIES ON LFS_MASTER_AREA.COMPANIES_ID = COMPANIES.COMPANIES_ID WHERE (LFS_MASTER_AREA.COMPANY_ID = @companyId) AND (LFS_MASTER_AREA.USMH LIKE @usmh) AND (LFS_MASTER_AREA.Deleted = 0) AND (LFS_MASTER_AREA.Archived = 0) ORDER BY LFS_MASTER_AREA.USMH, LFS_MASTER_AREA.RecordID DESC"; break; case "view_fulllength.aspx": commandText = "SELECT LFS_MASTER_AREA.ID, LFS_MASTER_AREA.COMPANY_ID, LFS_MASTER_AREA.RecordID, LFS_MASTER_AREA.COMPANIES_ID, COMPANIES.NAME, LFS_MASTER_AREA.Street, LFS_MASTER_AREA.USMH, LFS_MASTER_AREA.DSMH, LFS_MASTER_AREA.P1Date, LFS_MASTER_AREA.M1Date, LFS_MASTER_AREA.M2Date, LFS_MASTER_AREA.InstallDate, LFS_MASTER_AREA.Deleted, LFS_MASTER_AREA.Archived, CAST (0 AS BIT) AS Selected FROM LFS_MASTER_AREA INNER JOIN LFS_RESOURCES_COMPANIES AS COMPANIES ON LFS_MASTER_AREA.COMPANIES_ID = COMPANIES.COMPANIES_ID WHERE (LFS_MASTER_AREA.COMPANY_ID = @companyId) AND (LFS_MASTER_AREA.USMH LIKE @usmh) AND (LFS_MASTER_AREA.FullLengthLining = 1) AND (LFS_MASTER_AREA.Deleted = 0) AND (LFS_MASTER_AREA.Archived = 0) ORDER BY LFS_MASTER_AREA.USMH, LFS_MASTER_AREA.RecordID DESC"; break; case "view_pointliner.aspx": commandText = "SELECT LFS_MASTER_AREA.ID, LFS_MASTER_AREA.COMPANY_ID, LFS_MASTER_AREA.RecordID, LFS_MASTER_AREA.COMPANIES_ID, COMPANIES.NAME, LFS_MASTER_AREA.Street, LFS_MASTER_AREA.USMH, LFS_MASTER_AREA.DSMH, LFS_MASTER_AREA.P1Date, LFS_MASTER_AREA.M1Date, LFS_MASTER_AREA.M2Date, LFS_MASTER_AREA.InstallDate, LFS_MASTER_AREA.Deleted, LFS_MASTER_AREA.Archived, CAST (0 AS BIT) AS Selected FROM LFS_MASTER_AREA INNER JOIN LFS_RESOURCES_COMPANIES AS COMPANIES ON LFS_MASTER_AREA.COMPANIES_ID = COMPANIES.COMPANIES_ID WHERE (LFS_MASTER_AREA.COMPANY_ID = @companyId) AND (LFS_MASTER_AREA.USMH LIKE @usmh) AND ( (LFS_MASTER_AREA.PointLining = 1) OR (LFS_MASTER_AREA.Grouting = 1) OR (LFS_MASTER_AREA.LateralLining = 1) OR (LFS_MASTER_AREA.JLiner = 1) OR (LFS_MASTER_AREA.RehabAssessment = 1) ) AND (LFS_MASTER_AREA.Deleted = 0) AND (LFS_MASTER_AREA.Archived = 0) ORDER BY LFS_MASTER_AREA.USMH, LFS_MASTER_AREA.RecordID DESC"; break; case "view_scopesheet.aspx": commandText = "SELECT LFS_MASTER_AREA.ID, LFS_MASTER_AREA.COMPANY_ID, LFS_MASTER_AREA.RecordID, LFS_MASTER_AREA.COMPANIES_ID, COMPANIES.NAME, LFS_MASTER_AREA.Street, LFS_MASTER_AREA.USMH, LFS_MASTER_AREA.DSMH, LFS_MASTER_AREA.P1Date, LFS_MASTER_AREA.M1Date, LFS_MASTER_AREA.M2Date, LFS_MASTER_AREA.InstallDate, LFS_MASTER_AREA.Deleted, LFS_MASTER_AREA.Archived, CAST (0 AS BIT) AS Selected FROM LFS_MASTER_AREA INNER JOIN LFS_RESOURCES_COMPANIES AS COMPANIES ON LFS_MASTER_AREA.COMPANIES_ID = COMPANIES.COMPANIES_ID WHERE (LFS_MASTER_AREA.COMPANY_ID = @companyId) AND (LFS_MASTER_AREA.USMH LIKE @usmh) AND (LFS_MASTER_AREA.PointLining = 1) AND (LFS_MASTER_AREA.IssueIdentified = 0) AND (LFS_MASTER_AREA.Deleted = 0) AND (LFS_MASTER_AREA.Archived = 0) ORDER BY LFS_MASTER_AREA.USMH, LFS_MASTER_AREA.RecordID DESC"; break; case "view_subcontractor.aspx": commandText = "SELECT LFS_MASTER_AREA.ID, LFS_MASTER_AREA.COMPANY_ID, LFS_MASTER_AREA.RecordID, LFS_MASTER_AREA.COMPANIES_ID, COMPANIES.NAME, LFS_MASTER_AREA.Street, LFS_MASTER_AREA.USMH, LFS_MASTER_AREA.DSMH, LFS_MASTER_AREA.P1Date, LFS_MASTER_AREA.M1Date, LFS_MASTER_AREA.M2Date, LFS_MASTER_AREA.InstallDate, LFS_MASTER_AREA.Deleted, LFS_MASTER_AREA.Archived, CAST (0 AS BIT) AS Selected FROM LFS_MASTER_AREA INNER JOIN LFS_RESOURCES_COMPANIES AS COMPANIES ON LFS_MASTER_AREA.COMPANIES_ID = COMPANIES.COMPANIES_ID WHERE (LFS_MASTER_AREA.COMPANY_ID = @companyId) AND (LFS_MASTER_AREA.USMH LIKE @usmh) AND (LFS_MASTER_AREA.SubcontractorLining = 1) AND (LFS_MASTER_AREA.Deleted = 0) AND (LFS_MASTER_AREA.Archived = 0) ORDER BY LFS_MASTER_AREA.USMH, LFS_MASTER_AREA.RecordID DESC"; break; case "view_jlinersheet.aspx": commandText = "SELECT LFS_MASTER_AREA.ID, LFS_MASTER_AREA.COMPANY_ID, LFS_MASTER_AREA.RecordID, LFS_MASTER_AREA.COMPANIES_ID, COMPANIES.NAME, LFS_MASTER_AREA.Street, LFS_MASTER_AREA.USMH, LFS_MASTER_AREA.DSMH, LFS_MASTER_AREA.P1Date, LFS_MASTER_AREA.M1Date, LFS_MASTER_AREA.M2Date, LFS_MASTER_AREA.InstallDate, LFS_MASTER_AREA.Deleted, LFS_MASTER_AREA.Archived, CAST (0 AS BIT) AS Selected FROM LFS_MASTER_AREA INNER JOIN LFS_RESOURCES_COMPANIES AS COMPANIES ON LFS_MASTER_AREA.COMPANIES_ID = COMPANIES.COMPANIES_ID WHERE (LFS_MASTER_AREA.COMPANY_ID = @companyId) AND (LFS_MASTER_AREA.USMH LIKE @usmh) AND (LFS_MASTER_AREA.JLiner = 1) AND (LFS_MASTER_AREA.Deleted = 0) AND (LFS_MASTER_AREA.Archived = 0) ORDER BY LFS_MASTER_AREA.USMH, LFS_MASTER_AREA.RecordID DESC"; break; } SqlCommand command = new SqlCommand(commandText, connection); command.Parameters.Add(new SqlParameter("@companyId", companyId)); command.Parameters.Add(new SqlParameter("@usmh", usmh + "%")); SqlDataAdapter dataAdapter = new SqlDataAdapter(command); TDSLFSRecordForNavigator dataSet = new TDSLFSRecordForNavigator(); dataAdapter.Fill(dataSet, "NAVIGATOR"); return dataSet; }
// // GetRecordsByCompanyIdClientTargetPage() // // Returns target page's records that match a Client name (where Name like %cleint%) ordered by client, recordId // public TDSLFSRecordForNavigator GetRecordsByCompanyIdClientTargetPage(int companyId, string client, string targetPage) { //--- Prepare search condition string[] tokens = client.Split(new char[]{' ',',',';','.',':','-','_','\\','/'}, 50); string condition = null; for (int i=0; i<tokens.Length; i++) { if (i==0) { condition = "COMPANIES.NAME LIKE '%" + tokens[i].ToString() + "%' "; } else { condition += "AND COMPANIES.NAME LIKE '%" + tokens[i].ToString() + "%' "; } } //--- Execute query SqlConnection connection = new SqlConnection(ConnectionString); string commandText = ""; switch(targetPage) { case "view_all.aspx": commandText = "SELECT LFS_MASTER_AREA.ID, LFS_MASTER_AREA.COMPANY_ID, LFS_MASTER_AREA.RecordID, LFS_MASTER_AREA.COMPANIES_ID, COMPANIES.NAME, LFS_MASTER_AREA.Street, LFS_MASTER_AREA.USMH, LFS_MASTER_AREA.DSMH, LFS_MASTER_AREA.P1Date, LFS_MASTER_AREA.M1Date, LFS_MASTER_AREA.M2Date, LFS_MASTER_AREA.InstallDate, LFS_MASTER_AREA.Deleted, LFS_MASTER_AREA.Archived, CAST (0 AS BIT) AS Selected FROM LFS_MASTER_AREA INNER JOIN LFS_RESOURCES_COMPANIES AS COMPANIES ON LFS_MASTER_AREA.COMPANIES_ID = COMPANIES.COMPANIES_ID WHERE (LFS_MASTER_AREA.COMPANY_ID = @companyId) AND (" + condition + ") AND (LFS_MASTER_AREA.Deleted = 0) AND (LFS_MASTER_AREA.Archived = 0) ORDER BY COMPANIES.NAME, LFS_MASTER_AREA.RecordID DESC"; break; case "view_fulllength.aspx": commandText = "SELECT LFS_MASTER_AREA.ID, LFS_MASTER_AREA.COMPANY_ID, LFS_MASTER_AREA.RecordID, LFS_MASTER_AREA.COMPANIES_ID, COMPANIES.NAME, LFS_MASTER_AREA.Street, LFS_MASTER_AREA.USMH, LFS_MASTER_AREA.DSMH, LFS_MASTER_AREA.P1Date, LFS_MASTER_AREA.M1Date, LFS_MASTER_AREA.M2Date, LFS_MASTER_AREA.InstallDate, LFS_MASTER_AREA.Deleted, LFS_MASTER_AREA.Archived, CAST (0 AS BIT) AS Selected FROM LFS_MASTER_AREA INNER JOIN LFS_RESOURCES_COMPANIES AS COMPANIES ON LFS_MASTER_AREA.COMPANIES_ID = COMPANIES.COMPANIES_ID WHERE (LFS_MASTER_AREA.COMPANY_ID = @companyId) AND (" + condition + ") AND (LFS_MASTER_AREA.FullLengthLining = 1) AND (LFS_MASTER_AREA.Deleted = 0) AND (LFS_MASTER_AREA.Archived = 0) ORDER BY COMPANIES.NAME, LFS_MASTER_AREA.RecordID DESC"; break; case "view_pointliner.aspx": commandText = "SELECT LFS_MASTER_AREA.ID, LFS_MASTER_AREA.COMPANY_ID, LFS_MASTER_AREA.RecordID, LFS_MASTER_AREA.COMPANIES_ID, COMPANIES.NAME, LFS_MASTER_AREA.Street, LFS_MASTER_AREA.USMH, LFS_MASTER_AREA.DSMH, LFS_MASTER_AREA.P1Date, LFS_MASTER_AREA.M1Date, LFS_MASTER_AREA.M2Date, LFS_MASTER_AREA.InstallDate, LFS_MASTER_AREA.Deleted, LFS_MASTER_AREA.Archived, CAST (0 AS BIT) AS Selected FROM LFS_MASTER_AREA INNER JOIN LFS_RESOURCES_COMPANIES AS COMPANIES ON LFS_MASTER_AREA.COMPANIES_ID = COMPANIES.COMPANIES_ID WHERE (LFS_MASTER_AREA.COMPANY_ID = @companyId) AND (" + condition + ") AND ( (LFS_MASTER_AREA.PointLining = 1) OR (LFS_MASTER_AREA.Grouting = 1) OR (LFS_MASTER_AREA.LateralLining = 1) OR (LFS_MASTER_AREA.JLiner = 1) OR (LFS_MASTER_AREA.RehabAssessment = 1) ) AND (LFS_MASTER_AREA.Deleted = 0) AND (LFS_MASTER_AREA.Archived = 0) ORDER BY COMPANIES.NAME, LFS_MASTER_AREA.RecordID DESC"; break; case "view_scopesheet.aspx": commandText = "SELECT LFS_MASTER_AREA.ID, LFS_MASTER_AREA.COMPANY_ID, LFS_MASTER_AREA.RecordID, LFS_MASTER_AREA.COMPANIES_ID, COMPANIES.NAME, LFS_MASTER_AREA.Street, LFS_MASTER_AREA.USMH, LFS_MASTER_AREA.DSMH, LFS_MASTER_AREA.P1Date, LFS_MASTER_AREA.M1Date, LFS_MASTER_AREA.M2Date, LFS_MASTER_AREA.InstallDate, LFS_MASTER_AREA.Deleted, LFS_MASTER_AREA.Archived, CAST (0 AS BIT) AS Selected FROM LFS_MASTER_AREA INNER JOIN LFS_RESOURCES_COMPANIES AS COMPANIES ON LFS_MASTER_AREA.COMPANIES_ID = COMPANIES.COMPANIES_ID WHERE (LFS_MASTER_AREA.COMPANY_ID = @companyId) AND (" + condition + ") AND (LFS_MASTER_AREA.PointLining = 1) AND (LFS_MASTER_AREA.IssueIdentified = 0) AND (LFS_MASTER_AREA.Deleted = 0) AND (LFS_MASTER_AREA.Archived = 0) ORDER BY COMPANIES.NAME, LFS_MASTER_AREA.RecordID DESC"; break; case "view_subcontractor.aspx": commandText = "SELECT LFS_MASTER_AREA.ID, LFS_MASTER_AREA.COMPANY_ID, LFS_MASTER_AREA.RecordID, LFS_MASTER_AREA.COMPANIES_ID, COMPANIES.NAME, LFS_MASTER_AREA.Street, LFS_MASTER_AREA.USMH, LFS_MASTER_AREA.DSMH, LFS_MASTER_AREA.P1Date, LFS_MASTER_AREA.M1Date, LFS_MASTER_AREA.M2Date, LFS_MASTER_AREA.InstallDate, LFS_MASTER_AREA.Deleted, LFS_MASTER_AREA.Archived, CAST (0 AS BIT) AS Selected FROM LFS_MASTER_AREA INNER JOIN LFS_RESOURCES_COMPANIES AS COMPANIES ON LFS_MASTER_AREA.COMPANIES_ID = COMPANIES.COMPANIES_ID WHERE (LFS_MASTER_AREA.COMPANY_ID = @companyId) AND (" + condition + ") AND (LFS_MASTER_AREA.SubcontractorLining = 1) AND (LFS_MASTER_AREA.Deleted = 0) AND (LFS_MASTER_AREA.Archived = 0) ORDER BY COMPANIES.NAME, LFS_MASTER_AREA.RecordID DESC"; break; case "view_jlinersheet.aspx": commandText = "SELECT LFS_MASTER_AREA.ID, LFS_MASTER_AREA.COMPANY_ID, LFS_MASTER_AREA.RecordID, LFS_MASTER_AREA.COMPANIES_ID, COMPANIES.NAME, LFS_MASTER_AREA.Street, LFS_MASTER_AREA.USMH, LFS_MASTER_AREA.DSMH, LFS_MASTER_AREA.P1Date, LFS_MASTER_AREA.M1Date, LFS_MASTER_AREA.M2Date, LFS_MASTER_AREA.InstallDate, LFS_MASTER_AREA.Deleted, LFS_MASTER_AREA.Archived, CAST (0 AS BIT) AS Selected FROM LFS_MASTER_AREA INNER JOIN LFS_RESOURCES_COMPANIES AS COMPANIES ON LFS_MASTER_AREA.COMPANIES_ID = COMPANIES.COMPANIES_ID WHERE (LFS_MASTER_AREA.COMPANY_ID = @companyId) AND (" + condition + ") AND (LFS_MASTER_AREA.JLiner = 1) AND (LFS_MASTER_AREA.Deleted = 0) AND (LFS_MASTER_AREA.Archived = 0) ORDER BY COMPANIES.NAME, LFS_MASTER_AREA.RecordID DESC"; break; } SqlCommand command = new SqlCommand(commandText, connection); command.Parameters.Add(new SqlParameter("@companyId", companyId)); SqlDataAdapter dataAdapter = new SqlDataAdapter(command); TDSLFSRecordForNavigator dataSet = new TDSLFSRecordForNavigator(); dataAdapter.Fill(dataSet, "NAVIGATOR"); return dataSet; }
/// <summary> /// Required method for Designer support - do not modify /// the contents of this method with the code editor. /// </summary> private void InitializeComponent() { this.tdsLfsRecordForNavigator = new TDSLFSRecordForNavigator(); ((System.ComponentModel.ISupportInitialize)(this.tdsLfsRecordForNavigator)).BeginInit(); this.cvSearch.ServerValidate += new System.Web.UI.WebControls.ServerValidateEventHandler(this.cvSearchCriteria_ServerValidate); // // tdsLfsRecordForNavigator // this.tdsLfsRecordForNavigator.DataSetName = "TDSLFSRecordForNavigator"; this.tdsLfsRecordForNavigator.Locale = new System.Globalization.CultureInfo("en-US"); ((System.ComponentModel.ISupportInitialize)(this.tdsLfsRecordForNavigator)).EndInit(); }
protected void btnSubmit_Click(object sender, System.EventArgs e) { Page.Validate("submitText"); if (Page.IsValid && (tbxSearch.Text.Trim() != "")) { // Get data from database gateway tdsLfsRecordForNavigator = this.SubmitSearch(); Session["tdsLfsRecordForNavigator"] = tdsLfsRecordForNavigator; navigator = tdsLfsRecordForNavigator.NAVIGATOR; Session["navigator"] = navigator; grdCWPNavigator.DataBind(); // Show results if (tdsLfsRecordForNavigator.NAVIGATOR.DefaultView.Count <= 0) { // ... No results // ... Store navigator state Session["ddlSearchSelectedIndex"] = ddlSearch.SelectedIndex; Session["tbxSearchText"] = tbxSearch.Text; Session["lblHintVisible"] = lblHint.Visible; Session["lblHintText"] = lblHint.Text; // ... Go to search page Response.Redirect("navigator.aspx?search_results=true"); } } }
/// //////////////////////////////////////////////////////////////////////// /// EVENTS /// protected void Page_Load(object sender, System.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 ((Request.QueryString["search_results"] == null) && (Request.QueryString["record_modified"] == null) && (Request.QueryString["record_deleted"] == null)) { Response.Redirect("./../error_page.aspx?error=" + "Invalid query string in navigator2.aspx"); } // Tag Page Session.Remove("navigatorDummy"); // If coming from navigator.aspx if (Request.QueryString["search_results"] != null) { // ... Restore navigator state ddlSearch.SelectedIndex = (int)Session["ddlSearchSelectedIndex"]; tbxSearch.Text = (string)Session["tbxSearchText"]; lblHint.Visible = (bool)Session["lblHintVisible"]; lblHint.Text = (string)Session["lblHintText"]; // ... Restore searched data tdsLfsRecordForNavigator = (TDSLFSRecordForNavigator)Session["tdsLfsRecordForNavigator"]; navigator = tdsLfsRecordForNavigator.NAVIGATOR; Session["navigator"] = navigator; } // If coming from target page if (Request.QueryString["record_modified"] != null) { // ...Restore navigator state ddlSearch.SelectedIndex = (int)Session["ddlSearchSelectedIndex"]; tbxSearch.Text = (string)Session["tbxSearchText"]; lblHint.Visible = (bool)Session["lblHintVisible"]; lblHint.Text = (string)Session["lblHintText"]; // ...Reload data if (Request.QueryString["record_modified"] == "true") { tdsLfsRecordForNavigator = this.SubmitSearch(); Session["tdsLfsRecordForNavigator"] = tdsLfsRecordForNavigator; navigator = tdsLfsRecordForNavigator.NAVIGATOR; Session["navigator"] = navigator; } else { tdsLfsRecordForNavigator = (TDSLFSRecordForNavigator)Session["tdsLfsRecordForNavigator"]; navigator = tdsLfsRecordForNavigator.NAVIGATOR; Session["navigator"] = navigator; } } // If coming from delete record if (Request.QueryString["record_deleted"] != null) { // ... Restore navigator state ddlSearch.SelectedIndex = (int)Session["ddlSearchSelectedIndex"]; tbxSearch.Text = (string)Session["tbxSearchText"]; lblHint.Visible = (bool)Session["lblHintVisible"]; lblHint.Text = (string)Session["lblHintText"]; // ... Reload data if (Request.QueryString["record_deleted"] == "true") { tdsLfsRecordForNavigator = this.SubmitSearch(); Session["tdsLfsRecordForNavigator"] = tdsLfsRecordForNavigator; navigator = tdsLfsRecordForNavigator.NAVIGATOR; Session["navigator"] = navigator; } else { tdsLfsRecordForNavigator = (TDSLFSRecordForNavigator)Session["tdsLfsRecordForNavigator"]; navigator = tdsLfsRecordForNavigator.NAVIGATOR; Session["navigator"] = navigator; } } // For the total rows if (tdsLfsRecordForNavigator.NAVIGATOR.Rows.Count > 0) { lblTotalRows.Text = "Total Rows: " + tdsLfsRecordForNavigator.NAVIGATOR.Rows.Count; lblTotalRows.Visible = true; } else { lblTotalRows.Visible = false; } } else { // Restore searched data (if any) tdsLfsRecordForNavigator = (TDSLFSRecordForNavigator)Session["tdsLfsRecordForNavigator"]; // For the total rows if (tdsLfsRecordForNavigator.NAVIGATOR.Rows.Count > 0) { lblTotalRows.Text = "Total Rows: " + tdsLfsRecordForNavigator.NAVIGATOR.Rows.Count; lblTotalRows.Visible = true; } else { lblTotalRows.Visible = false; } } }