protected override void OnLoad(EventArgs e) { base.OnLoad(e); ((StandardHeader)itatHeader).PageTitle = GetPageName(); int nSelectedRow = -1; if (!IsPostBack) { _reportManagedItemSort = null; try { //_CNTXT_ReportManagedItemSort is defined if from Report.aspx or could be defined if from ReportSearchResults.aspx _reportManagedItemSort = (Business.ReportManagedItemSort)Context.Items[Common.Names._CNTXT_ReportManagedItemSort]; } catch { } string selectedRow = Request.QueryString[Common.Names._QS_SELECTED_ROW]; int nTryParse; if (int.TryParse(selectedRow, out nTryParse)) { //From Report.aspx or from ReportSearchResults.aspx (in order to correctly display the checkboxes) nSelectedRow = nTryParse; _searchResults = (Business.SearchResults)Context.Items[Common.Names._CNTXT_SearchResults]; } else { if (_reportManagedItemSort == null) { //From ManagedItemSearch.aspx _report.SearchCriteria = (Business.SearchCriteria)Context.Items[Common.Names._CNTXT_SearchCriteria]; Business.ManagedItemSearch miSearch = new Kindred.Knect.ITAT.Business.ManagedItemSearch(); //If this is an 'admin viewer', then do not limit the search results based on security. _searchResults = miSearch.Search(_itatSystem.ID, _report.SearchCriteria, UserRolesOrAdminViewer()); _report.DefineTerms(_searchResults); } else { //From Report.aspx } } } else { //Update the selection criteria SetVisibility(true); //Note - the order is important here. If the same term is used for both, then //the second call will 'null out' the first. So if we call SetSecondary first, then //SetPrimary call will null out the SecondaryTerm. if (ddlSort1.Items.Count > 0 && ddlSort2.Items.Count > 0) { string[] sValues1 = ddlSort1.Items[ddlSort1.SelectedIndex].Value.Split(','); ; string[] sValues2 = ddlSort2.Items[ddlSort2.SelectedIndex].Value.Split(','); ; _report.SetSecondary(ddlSort2.Items[ddlSort2.SelectedIndex].Text, sValues2[1]); _report.SetPrimary(ddlSort1.Items[ddlSort1.SelectedIndex].Text, sValues1[1]); } } PopulateForm(nSelectedRow); }
protected override void LoadViewState(object savedState) { base.LoadViewState(savedState); _dsDropDownSortTerms = (DataSet)ViewState[VIEWSTATE_SORT_TERMS]; _searchResults = (Business.SearchResults)ViewState[VIEWSTATE_SEARCH_RESULTS]; _reportManagedItemSort = (Business.ReportManagedItemSort)ViewState[VIEWSTATE_REPORT_MANAGEDITEM_SORT]; }