Language preference:

Phase 6 / Filter Templates included with BLD

BLD has numerous Filter Templates, including some created with the Ajax Control Toolkit. Explore them below.

The EntityFilterPicker Filter Templates are especially interesting. They work together with the DESDA.RangeEntityFilterPickerAttribute and DESDA.DateRangeEntityFilterPickerAttribute, which are defined as DataAnnotations in your business rules. These create pick lists from number and date values, so you can have this kind of interface:


BLD has a powerful selection system to handle where you don't have a Filter Template that matches the situation. You can override that system by using the [web app]\BLD Templates\FilterTemplate.config file to specify alternative mapping.

<%Control Language="C#" Inherits="PeterBlum.DES.BLD.BooleanListFilterTemplate" %>
<script runat="server">
/* CUSTOMIZING THIS FILTER TEMPLATE: * 1. BooleanListFilterTemplate is recommended for the TemplateProperties and FilterTemplateProperties * collections of BLDFilterField, BLDPatternForFilterField, FilterFieldInPattern, and Customizer objects. * When using the Customizer to define page-level properties, * use the AnyFilterTemplateProperties class for those shared with other types of Filter Templates. * * 2. The DropDownList supports the Named Style "FilterTemplateDataControls". * * 3. Validators are installed automatically. This Filter Template installs the Required validator * by setting the Required property to true on BLDFilterField, BLDPatternForFilterField and FilterFieldInPattern objects. * Change its error message with * AnyFilterTemplateProperties.RequiredMessages-ErrorMessage="Required" * * 4. ErrorMessages can use the token "{LABEL}" which is replaced by * the Label property on BLDFilterField, BLDPatternForFilterField and FilterFieldInPattern objects. * * 5. The ErrorFormatter can be changed with the AnyFilterTemplateProperties.ErrorFormatterSkinID property * * 6. Labels for True and False shown in the DropDownList can be changed with these properties: * BooleanListFilterTemplate.TextForTrue='yes' * BooleanListFilterTemplate.TextForFalse='no' * * 7. Labels for [Ignore] and [Not set] shown in the DropDownList can be changed with these properties: * BooleanListFilterTemplate.IgnoreFilterText='[Ignore]' * BooleanListFilterTemplate.UnassignedValueText='[Not set]' * * EXAMPLE: * <des:BLDFilterField id="id" runat="server" DataField="FieldName" UIHint="Boolean" * Required="true" > * <TemplateProperties> * <des:BooleanListFilterTemplate RequiredMessages-ErrorMessage="Required" Label-Text="Name" * ErrorFormatterSkinID="PopupView {Display='Dynamic'}" /> * </TemplateProperties> * <NamedStyle> * <des:NamedStyle Name="FilterTemplateDataControls" CssClass="MyClass" Style="width:100px;color:#e9e9e9;"/> * </NamedStyle> * </des:BLDFilterField> */ public void Page_Init(object sender, EventArgs e) { SetupDataControls(DropDownList1); } /// <summary> /// If you modify this Filter Template, change this to reflect /// the presence of block style tags (like div, table, ol, and ul) or /// a br tag. /// If any exist at the very end, return ContainsBlockElement.EndsWith. /// If any exist but none at the end, return ContainsBlockElement.BeforeEnd. /// Otherwise return ContainsBlockElement.None. /// </summary> protected override PeterBlum.DES.BLD.ContainsBlockElement ContainsBlockElementOrBreak() { return PeterBlum.DES.BLD.ContainsBlockElement.None; // select tag is inline type }
</script> <asp:DropDownList runat="server" ID="DropDownList1" />

In the next topic, you will learn about adding a Filter Interface using the BLDPatternForFilterFields control.