Databases Reference
In-Depth Information
Built-in Filter Templates
Perhaps the reason why the lookup algorithm for filter templates is so simplistic compared
to field templates is that only three filter templates come with a Dynamic Data web
project by default.
Boolean
The Boolean filter template is used for columns of Boolean type. It contains a
DropDownList control that allows the user to choose filter value from All , True , False ,
and [Not Set] if the column allows null values.
Enumeration
The Enumeration filter template is used for columns of enum types or integer columns
marked with the EnumDataTypeAttribute that specifies an enum type. It contains a
DropDownList control that allows users to choose filter value from All, [Not Set]
(if the column allows null values), as well as the string names of all items in the enumer-
ated type.
ForeignKey
The ForeignKey filter template is used for foreign key columns. It displays all records from
the parent table referenced by the foreign key column in a DropDownList control, plus All
and [Not Set] (if the column allows null values). Each ListItem represents a single row
from the parent table. Its Value property contains a comma-separated list of primary key
column values. The Text property value is determined by calling the GetDisplayString
method of the MetaTable instance describing the parent table. If the parent entity class
overrides the ToString method, the value returned by this method is used; otherwise, the
value of the display column of the parent entity class is used. Display column can be spec-
ified explicitly, by applying the DisplayColumnAttribute to the entity class, or determined
heuristically, in which case the value of the first string property is used.
Summary
A filter template is a special type of user control that encapsulates both user interface and
data access logic required to filter rows of a particular table based on the values of a single
column. Filter template modifies the LINQ query created by a data source control to apply
the filter criteria dynamically, based on the search parameter entered by the user. Multiple
instances of the same filter template can be used in an application for different columns
of the same type. Dynamic Data includes a small number of ready-to-use filter templates,
including templates for Boolean, enumeration, and foreign key columns. New filter
templates can be implemented using built-in or third-party ASP.NET controls and LINQ
expressions or dynamic LINQ extensions.
 
 
Search WWH ::




Custom Search