|
28 | 28 | <format type="text/markdown">< |
34 |
| -
|
35 |
| -- [ClassContext](#ClassContext) |
36 |
| -
|
37 |
| -- [Declarative Syntax](#DeclarativeSyntax) |
| 33 | +- [Introduction](#introduction) |
| 34 | +- [ClassContext](#ClassContext) |
| 35 | +- [Declarative Syntax](#DeclarativeSyntax) |
38 | 36 |
|
39 | 37 | <a name="introduction"></a>
|
40 | 38 | ## Introduction
|
|
51 | 49 | You can specify the filter template to use in the following ways:
|
52 | 50 |
|
53 | 51 | - By using the <xref:System.Web.DynamicData.DynamicFilter.FilterUIHint%2A> property in page markup. This approach is a presentation-layer customization, which is independent of the schema (database), and which applies to a single page.
|
54 |
| -
|
55 | 52 | - By using the <xref:System.ComponentModel.DataAnnotations.FilterUIHintAttribute> attribute in the model. This approach is a data-layer customization, which depends on the specific schema (database), and which applies to the entire application.
|
56 | 53 |
|
57 | 54 | If you use both approaches, the filter template that is specified in the markup takes precedence over the template that is specified in the data model.
|
|
62 | 59 |
|
63 | 60 | The following figure shows the steps that Dynamic Data follows in order to implement table row filtering by a foreign-key column.
|
64 | 61 |
|
65 |
| -  |
66 |
| -
|
67 |
| -1. The <xref:System.Web.DynamicData.DynamicFilter> control passes the selected value to the <xref:System.Web.UI.WebControls.QueryExtender> control. |
68 |
| -
|
69 |
| -2. The <xref:System.Web.UI.WebControls.QueryExtender> control uses the value to create the query filtering information. It then passes this information to the data source control. |
70 |
| -
|
71 |
| -3. The data source control passes the filtering query information to the data source provider. |
| 62 | +  |
72 | 63 |
|
73 |
| -4. The data source provider passes the query to the database. |
74 |
| -
|
75 |
| -5. The database returns the filtered table rows. |
76 |
| -
|
77 |
| -6. The data source provider sends this data back to the data source control. |
78 |
| -
|
79 |
| -7. The data source control passes the filtered table rows to the data-bound control for display. |
| 64 | +1. The <xref:System.Web.DynamicData.DynamicFilter> control passes the selected value to the <xref:System.Web.UI.WebControls.QueryExtender> control. |
| 65 | +2. The <xref:System.Web.UI.WebControls.QueryExtender> control uses the value to create the query filtering information. It then passes this information to the data source control. |
| 66 | +3. The data source control passes the filtering query information to the data source provider. |
| 67 | +4. The data source provider passes the query to the database. |
| 68 | +5. The database returns the filtered table rows. |
| 69 | +6. The data source provider sends this data back to the data source control. |
| 70 | +7. The data source control passes the filtered table rows to the data-bound control for display. |
80 | 71 |
|
81 | 72 | <a name="DeclarativeSyntax"></a>
|
82 | 73 | ## Declarative Syntax
|
83 | 74 |
|
84 |
| -``` |
| 75 | +```xml |
85 | 76 | <asp:DynamicFilter
|
86 |
| - ID="Control ID" |
87 |
| - DataField="Name of the data field to use for filtering" |
88 |
| - EnableViewState="True|False" |
89 |
| - FilterUIHint="Name of the filter template to generate the UI" |
90 |
| - OnFilterChanged="Filter changed event handler" |
91 |
| - OnDataBinding="DataBinding event handler" |
92 |
| - OnDisposed="Disposed event handler" |
93 |
| - OnInit="Init event handler" |
94 |
| - OnLoad="Load event handler" |
95 |
| - OnPreRender="PreRender event handler" |
96 |
| - OnUnload="Unload event handler" |
97 |
| - Visible="True|False" |
98 |
| - runat="server"/> |
| 77 | + ID="Control ID" |
| 78 | + DataField="Name of the data field to use for filtering" |
| 79 | + EnableViewState="True|False" |
| 80 | + FilterUIHint="Name of the filter template to generate the UI" |
| 81 | + OnFilterChanged="Filter changed event handler" |
| 82 | + OnDataBinding="DataBinding event handler" |
| 83 | + OnDisposed="Disposed event handler" |
| 84 | + OnInit="Init event handler" |
| 85 | + OnLoad="Load event handler" |
| 86 | + OnPreRender="PreRender event handler" |
| 87 | + OnUnload="Unload event handler" |
| 88 | + Visible="True|False" |
| 89 | + runat="server"/> |
99 | 90 | ```
|
100 | 91 |
|
101 |
| -
|
102 |
| -
|
103 | 92 | ## Examples
|
104 |
| - A Visual Studio project with source code is available at this location: [Download](https://go.microsoft.com/fwlink/?LinkId=168914). |
105 | 93 |
|
106 | 94 | The following examples use the default ForeignKey.ascx filter template to create the UI for filtering the Products table rows by the ProductCategory foreign-key column. When the user selects a ProductCategory value, only the rows that contain that value are displayed.
|
107 | 95 |
|
|
0 commit comments