Renders a query-by-example form that performs filtering on a persistent data source.
For a list of all members of this type, see QueryForm Members.
System.Object
Control
WebControl
BaseDataBoundControl
QueryForm
The QueryForm control renders a query-by-example form and performs automatic filtering on a persistent data source. Set the GenomeDataSourceID property to specify the ID of the associated GenomeDataSource control to filter. The QueryForm subscribes to the GenomeDataSource.Selecting event to perform the filtering. Note that data-bound controls do not need to be changed; they can connect directly to the GenomeDataSource, as before.
Each row of the QueryForm must be specified explicitly with a QueryField implementation which usually represents a filter to be applied on the data source. The query fields are accessible through the Fields property and can be specified in the markup. Each QueryField must maintain an IQueryFilter that represents the filter logic, and render controls where users can enter parameters for search criteria. The query fields are not only able to extract a filter based on user input, but they can also be data-bound to a filter of appropriate type and refresh the user controls with the bound data.
The QueryForm maintains a collection of filters in the Filters property where each filter corresponds to a query field. When the Filter operation is performed, the values of user controls are extracted by the query fields and the filter collection is updated with the new filters. The GenomeDataSource is then notified, causing all data-bound controls attached to the data source to be updated.
The EqualsQueryField and LikeQueryField query field implementations render a TextBox control and filter the selected property of the business type with either the equality or like operator. The ReferenceQueryField can filter a persistent reference property and renders a list of persistent objects in a drop-down field. The TemplateQueryField query field implementation can be used to render custom controls and perform custom filter logic in the QueryForm.
In the following example, a GridView control lists Customer objects. The GridView is connected to a GenomeDataSource that returns all customers by default. The QueryForm is attached to the GenomeDataSource to filter the Customer items.
In the QueryForm, several LikeQueryField query fields are used, each of them bound to different properties of the Customer type. These query fields render a TextBox and filter the specified property with the LIKE operator.
<genome:GenomeDataSource ID="CustomerDataSource" runat="server"
AutoCommit="True" AutoLock="False"
DataSourceProviderMemberName="GetCustomer"
DataSourceProviderTypeName="WebApp.CustomerList"
ElementTypeName="Northwind.Business.Customer"
DataDomainRole="<%$AppSettings: DataDomainRole%>">
</genome:GenomeDataSource>
<genomeControls:QueryForm ID="CustomerQueryForm" runat="server" GenomeDataSourceID="CustomerDataSource" OnCommand="CustomerQueryForm_Command">
<Fields>
<genomeControls:LikeQueryField PropertyName="CustomerId" HeaderText="Customer Id" />
<genomeControls:LikeQueryField PropertyName="CompanyName" HeaderText="Company Name" />
<genomeControls:LikeQueryField PropertyName="ContactName" HeaderText="Contact Name" />
<genomeControls:LikeQueryField PropertyName="ContactTitle" HeaderText="Contact Title" />
<genomeControls:LikeQueryField PropertyName="Address" HeaderText="Address" />
<genomeControls:LikeQueryField PropertyName="City" HeaderText="City" />
<genomeControls:LikeQueryField PropertyName="Region" HeaderText="Region" />
<genomeControls:LikeQueryField PropertyName="PostalCode" HeaderText="Postal Code" />
<genomeControls:LikeQueryField PropertyName="Country" HeaderText="Country" />
<genomeControls:LikeQueryField PropertyName="Phone" HeaderText="Phone" />
<genomeControls:LikeQueryField PropertyName="Fax" HeaderText="Fax" />
<genomeControls:QueryCommandField ShowFilterButton="true" ShowShowAllButton="true" ValidationGroup="CustomerQueryForm" ItemStyle-CssClass="Genome-QueryForm-Footer" />
</Fields>
</genomeControls:QueryForm>
<asp:GridView ID="CustomerGridView" runat="server"
AllowPaging="True" AllowSorting="True"
EmptyDataText="No item selected"
AutoGenerateColumns="False"
DataKeyNames="datakey"
DataSourceID="CustomerDataSource">
<Columns>
<asp:CommandField ShowEditButton="False" ShowDeleteButton="True" ValidationGroup="CustomerGridView" />
<asp:HyperLinkField HeaderText="Customer Id" SortExpression="CustomerId" DataTextField="CustomerId" DataTextFormatString="{0}" DataNavigateUrlFields="datakey" DataNavigateUrlFormatString="~/CustomerDetails.aspx?datakey={0}" />
<asp:BoundField DataField="CompanyName" HeaderText="Company Name" SortExpression="CompanyName" ReadOnly="False" InsertVisible="True" />
<asp:BoundField DataField="ContactName" HeaderText="Contact Name" SortExpression="ContactName" ReadOnly="False" InsertVisible="True" />
<asp:BoundField DataField="ContactTitle" HeaderText="Contact Title" SortExpression="ContactTitle" ReadOnly="False" InsertVisible="True" />
<asp:BoundField DataField="Address" HeaderText="Address" SortExpression="Address" ReadOnly="False" InsertVisible="True" />
<asp:BoundField DataField="City" HeaderText="City" SortExpression="City" ReadOnly="False" InsertVisible="True" />
<asp:BoundField DataField="Region" HeaderText="Region" SortExpression="Region" ReadOnly="False" InsertVisible="True" />
<asp:BoundField DataField="PostalCode" HeaderText="Postal Code" SortExpression="PostalCode" ReadOnly="False" InsertVisible="True" />
<asp:BoundField DataField="Country" HeaderText="Country" SortExpression="Country" ReadOnly="False" InsertVisible="True" />
<asp:BoundField DataField="Phone" HeaderText="Phone" SortExpression="Phone" ReadOnly="False" InsertVisible="True" />
<asp:BoundField DataField="Fax" HeaderText="Fax" SortExpression="Fax" ReadOnly="False" InsertVisible="True" />
</Columns>
</asp:GridView>
Namespace: TechTalk.Genome.Extensions.Web.UI.Controls
Assembly: TechTalk.Genome.Extensions.Web (in TechTalk.Genome.Extensions.Web.dll)
Version: 4.2.4.4
Editions: Professional, Evaluation, Express
QueryForm Members | TechTalk.Genome.Extensions.Web.UI.Controls Namespace