Databases Reference
In-Depth Information
This filter template would also need a nested DynamicFilter control to load another filter
template, appropriate for the specified DisplayField . The following snippet shows how
markup of this filter template could look:
<%@ Control Language=”C#” CodeBehind=”Parent.ascx.cs”
Inherits=”WebApplication.DynamicData.Filters.ParentFilter” %>
<asp:DynamicFilter ID=”filter” runat=”server” OnInit=”Filter_Init”/>
Unfortunately, it is not possible to use the DynamicFilter control inside of a filter
template like this. Internal implementation of the DynamicFilter control relies on the
InitComplete event of the Page class to instantiate the filter template, and by the time the
nested DynamicFilter is created, this event has already fired, and the nested filter
template is never created.
Overcoming Limitations of Dynamic Filters
To be consistent with the capabilities offered by the DynamicControl , the DynamicFilter
control needs to support custom attributes and work inside of other filter templates. These
capabilities are important not only for consistency's sake; without them, the DynamicFilter
control encourages embedding presentation information in the business layer and limits
your ability to create advanced filter templates necessary for real-world search pages.
Unfortunately, implementation of the DynamicFilter in ASP.NET version 4.0 does not
allow you to fix these problems by inheriting from and extending this control. The only
way to eliminate them is by completely rewriting this control along with other controls
and classes that depend on it. Table 12.1 shows the original controls that come with
Dynamic Data and the replacement controls you can find in the source code accompany-
ing this topic.
TABLE 12.1 Replacement Filter Classes and Controls
Built-in
Replacement
QueryableFilterUserControl
UnleashedFilterTemplate
DynamicFilter
UnleashedFilter
DynamicFilterExpression
UnleashedFilterExpression
QueryableFilterRepeater
UnleashedFilterRepeater
With the exception of the UnleashedFilterTemplate , which inherits from the
QueryableFilterUserControl , the rest of these classes are not related to the corresponding
built-in classes that come with Dynamic Data. However, they are designed to be fully-
compatible with their built-in equivalents and allow you to simply change the class names
in markup and source files of your application. Figure 12.2 shows a class diagram that
provides a high-level overview of the new classes.
 
Search WWH ::




Custom Search