Databases Reference
In-Depth Information
FIGURE 1.14
GridView with Dynamic Field Generator.
In a real-world application, the number of products would probably exceed the mere eight
pages in the Northwind sample. Thus, no application would be complete without some
form of search functionality. Consider Listing 1.16, where the grid page has been extended
from the previous example with a
DynamicFilter
and a
QueryExtender
control.
LISTING 1.16
QueryExtender and DynamicFilter Sample (Markup)
<%@ Page Language=”C#”
MasterPageFile=”~/Site.master” CodeBehind=”SamplePage.aspx.cs”
Inherits=”WebApplication.Samples.Ch01.DynamicFilter.SamplePage” %>
<asp:Content ContentPlaceHolderID=”main” runat=”server”>
Filter by Category:
<asp:DynamicFilter ID=”categoryFilter” DataField=”Category” runat=”server” />
<asp:ValidationSummary runat=”server”/>
<asp:GridView ID=”gridView” runat=”server” DataSourceID=”dataSource”
DataKeyNames=”ProductID” AutoGenerateEditButton=”true”
AllowPaging=”true” AutoGenerateColumns=”true”/>
<asp:EntityDataSource ID=”dataSource” runat=”server”