/// <summary> /// Fill page size filter drop-down with settings from web part configuration. /// </summary> private void FillPagingDropDown() { drpPaging.Items.Add(new ListItem(GetString("General.SelectAll"), "0")); if (!string.IsNullOrEmpty(PagingOptions)) { // Parse PagingOptions string and fill dropdown string[] pageOptions = PagingOptions.Split(','); foreach (string pageOption in pageOptions) { if (pageOption.Trim() != string.Empty) { drpPaging.Items.Add(new ListItem(pageOption.Trim())); } } } // Hide paging if (drpPaging.Items.Count < 1) { drpPaging.Visible = false; lblPaging.Visible = false; } }
/// <summary> /// Setups the control. /// </summary> private void SetupControl() { if (!StopProcessing) { // Show/Hide manufacturer filter if (ShowManufacturerFilter) { lblManufacturer.Text = ResHelper.GetString("ecommerce.filter.product.manufacturer"); manufacturerSelector.InnerControl.CssClass = "DropDownList"; } else { lblManufacturer.Visible = false; manufacturerSelector.Visible = false; } // Show/Hide public status filter if (ShowPublicStatusFilter) { lblStatus.Text = ResHelper.GetString("ecommerce.filter.product.status"); statusSelector.InnerControl.CssClass = "DropDownList"; } else { lblStatus.Visible = false; statusSelector.Visible = false; } // Show/Hide stock filter if (ShowStockFilter) { chkStock.Text = ResHelper.GetString("ecommerce.filter.product.stock"); } else { chkStock.Visible = false; } // Show/Hide paging filter if (ShowPagingFilter) { lblPaging.Text = ResHelper.GetString("ecommerce.filter.product.paging"); } else { lblPaging.Visible = false; drpPaging.Visible = false; } // Show/Hide sorting filter if (ShowSortingFilter) { lblSort.Text = ResHelper.GetString("ecommerce.filter.product.sort"); } else { lblSort.Visible = false; drpSort.Visible = false; } // Show/Hide search filter if (ShowSearchFilter) { lblSearch.Text = ResHelper.GetString("ecommerce.filter.product.search"); } else { lblSearch.Visible = false; txtSearch.Visible = false; } bool firstRowVisible = (ShowSearchFilter || ShowPublicStatusFilter || ShowManufacturerFilter || ShowStockFilter); bool secondRowVisible = (ShowPagingFilter || ShowSortingFilter); plcFirstRow.Visible = firstRowVisible; plcSecondRow.Visible = secondRowVisible; plcFirstButton.Visible = (firstRowVisible && !secondRowVisible); plcSecButton.Visible = secondRowVisible; button = secondRowVisible ? btnSecFilter : btnFirstFilter; button.Text = ResHelper.GetString("ecommerce.filter.product.filter"); pnlContainer.DefaultButton = button.ID; if (!RequestHelper.IsPostBack()) { // Initialize dropdowns drpSort.Items.Add(new ListItem(ResHelper.GetString("ecommerce.filter.product.nameasc"), "nameasc")); drpSort.Items.Add(new ListItem(ResHelper.GetString("ecommerce.filter.product.namedesc"), "namedesc")); drpSort.Items.Add(new ListItem(ResHelper.GetString("ecommerce.filter.product.priceasc"), "priceasc")); drpSort.Items.Add(new ListItem(ResHelper.GetString("ecommerce.filter.product.pricedesc"), "pricedesc")); drpPaging.Items.Add(new ListItem(ResHelper.GetString("General.SelectAll"), "0")); if ((PagingOptions != null) && (PagingOptions != string.Empty)) { // Parse PagingOptions string and fill dropdown string[] pageOptions = PagingOptions.Split(','); foreach (string pageOption in pageOptions) { if (pageOption.Trim() != string.Empty) { drpPaging.Items.Add(new ListItem(pageOption.Trim())); } } } else { // Hide paging drpPaging.Visible = false; lblPaging.Visible = false; } if (FilterByQuery) { // Get filter setings from query GetFilter(); } } // Section 508 validation lblManufacturer.AssociatedControlClientID = manufacturerSelector.ValueElementID; lblStatus.AssociatedControlClientID = statusSelector.ValueElementID; lblSearch.AssociatedControlClientID = txtSearch.ClientID; } else { statusSelector.StopProcessing = true; manufacturerSelector.StopProcessing = true; } }