Filter Templates
Back to Product Overview
|
Next topic |
Language preference:
Filtering data – applying limits to what data is returned by your queries – is an essential element to data oriented applications.
A Filter Template is a User Control file that builds a user interface for a single filter rule, based on the data type and filtering rules you need. BLD provides an extensive framework of classes for developing Filter Templates, and a large number of Filter Template files have been included.
Filter Templates convert the data input from the user into EntityFilter objects which are then passed to the DataSource control.
Here’s a look inside of Decimal.ascx, the Filter Template for establishing a range on a decimal data type:
<%@ Control Language="C#" Inherits="PeterBlum.DES.BLD.NumericTextBoxRangeFilterTemplate" %>
<script runat="server">
protected void Page_Init(object sender, EventArgs e)
{
SetupFilterControls(Start, End);
SetupThruLabelControl(Thru);
}
</script>
<des:DecimalTextBox id="Start" runat="server" ShowSpinner="true" />
<des:LocalizableLabel id="Thru" runat="server" AssociatedControlID="End" />
<des:DecimalTextBox id="End" runat="server" ShowSpinner="true" />
In this case, the PeterBlum.DES.BLD.NumericTextBoxRangeFilterTemplate class has you register
the textboxes and label within Page_Init. It does the rest, using the field to filter
to determine various business rules and public properties to assign a label to the LocalizableLabel control.
A Filter Template can support any kind of input
control, including those from a third party. (However, a specific class like
PeterBlum.DES.BLD.NumericTextBoxRangeFilterTemplate can only handle the specific control
classes for which its intended.)
You use the BLDFilterField control whereever you want a Filter Template
to be inserted into your Web Form. Specify the DataField in its DataField property.
(Remember that a DataField is the property name in the Entity class.)
It will choose a Filter Template based on the DataTypeAttribute or field's actual type. You can override that by
specifying the Filter Template's name in the UIHint property (omitting the extension.)
<des:BLDFilterField id="ProductNameFilter" runat="server" DataField="ProductName"
UIHint="TextWithOptions"/>
<des:BLDFilterField id="UnitPriceFilter" runat="server" DataField="UnitPrice" />
When you want to change how a Filter Template works, it may seem obvious to just go an edit its file. Before you do that, evaluate the many ways Filter Templates let the Web Form developer customize it.
- Each Filter Template User Control class defines public properties that can you can
assign using the BLDFilterField's TemplateProperties collection.
- The Named Styles lets you override default styles on controls inside of the Filter Template
and Pattern Templates.
Filter Templates provided with BLD
BLD includes the following Filter Templates, many of which utilize data entry controls
from the Peter's TextBoxes and Peter's Date and Time modules of Peter's Data Entry suite.
Template name
|
Data Type
|
Filter Rule
|
Boolean.ascx
|
Boolean
|
Compare To Value
|
BooleanRadio.ascx
|
Boolean
|
Compare To Value
|
BooleanUsingHyperinks.ascx
|
Boolean
|
Compare To Value
|
Currency.ascx
|
Currency
|
Range
|
CurrencyCompare.ascx
|
Currency
|
Compare To Value
|
CurrencyEquals.ascx
|
Currency
|
Compare To Value with Equals operator
|
Date.ascx
|
Date
|
Range
|
DateCompare.ascx
|
Date
|
Compare To Value
|
DateEquals.ascx
|
Date
|
Compare To Value with Equals operator
|
DateTime.ascx
|
DateTime
|
Range
|
DateTimeCompare.ascx
|
DateTime
|
Compare To Value
|
DateTimeEquals.ascx
|
DateTime
|
Compare To Value with Equals operator
|
Decimal.ascx
|
Decimal
|
Range
|
DecimalCompare.ascx
|
Decimal
|
Compare To Value
|
DecimalEquals.ascx
|
Decimal
|
Compare To Value with Equals operator
|
Duration.ascx
|
Duration
|
Range
|
DurationCompare.ascx
|
Duration
|
Compare To Value
|
DurationEquals.ascx
|
Duration
|
Compare To Value with Equals operator
|
EntityFilterPicker.ascx
|
EntityFilterPickerAttribute
|
EntityFilterPickerAttribute specifies
|
EntityFilterPickerMultiSelection.ascx
|
EntityFilterPickerAttribute
|
EntityFilterPickerAttribute specifies
|
EntityFilterPickerUsingHyperlinks.ascx
|
EntityFilterPickerAttribute
|
EntityFilterPickerAttribute specifies
|
EntityFilterPickerUsingListBox.ascx
|
EntityFilterPickerAttribute
|
EntityFilterPickerAttribute specifies
|
Enumerated.ascx
|
Enumerated
|
Compare to Value
|
EnumeratedMultiSelection.ascx
|
Enumerated
|
Collection of Compare to Values with OR operator
|
EnumeratedUsingHyperlinks.ascx
|
Enumerated
|
Compare to Value
|
ForeignKey.ascx
|
One to One relationship
|
Compare to Value
|
ForeignKeyMultiSelection.ascx
|
One to One relationship
|
Collection of Compare to Values with OR operator
|
ForeignKeyUsingHyperlinks.ascx
|
One to One relationship
|
Compare to Value
|
Integer.ascx
|
Integer
|
Range
|
IntegerCompare.ascx
|
Integer
|
Compare To Value
|
IntegerEquals.ascx
|
Integer
|
Compare To Value with Equals operator
|
Percent.ascx
|
Percent
|
Range
|
PercentCompare.ascx
|
Percent
|
Compare To Value
|
PercentEquals.ascx
|
Percent
|
Compare To Value with Equals operator
|
Text.ascx
|
String
|
TextSearch
|
TextMultiFieldWithOptions.ascx
|
String
|
MultiFieldTextSearch
|
TextWithOptions.ascx
|
String
|
TextSearch
|
TextWithRange.ascx
|
String
|
Range
|
Time.ascx
|
Time
|
Range
|
TimeCompare.ascx
|
Time
|
Compare To Value
|
TimeEquals.ascx
|
Time
|
Compare To Value with Equals operator
|
Back to Product Overview
|
Next topic