<%@
Page Language="C#" MasterPageFile="~/DefaultMaster.master" AutoEventWireup="true" CodeFile="Filtering.aspx.cs" Inherits="Filtering" Title="Untitled Page" %>
<%@
Register Assembly="ExtendedObjectDataSource" Namespace="Manu.Web.UI.WebControls" TagPrefix="manu" %>
<asp:Content
ID="Content1" ContentPlaceHolderID="Content" Runat="Server">
<h1>Advanced Filtering</h1>
Filter expression:
<asp:TextBox
ID="txtFilter" runat="server">id >
0</asp:TextBox>
<asp:RequiredFieldValidator
ID="rfvFilter"
runat="server"
ControlToValidate="txtFilter"
Display="Dynamic" ErrorMessage="Please enter a expression to filter data">
</asp:RequiredFieldValidator>
<asp:Button
ID="bFilter" runat="server" OnClick="bFilter_Click" Text="Refresh
results with current filter"
/>
<br
/><br
/>
<asp:GridView
ID="GridView1" runat="server" AllowPaging="True" AllowSorting="True"
AutoGenerateColumns="False"
AutoGenerateDeleteButton="True" AutoGenerateEditButton="True"
DataKeyNames="Id"
DataSourceID="ObjectDataSource1"
PageSize="4"
CssClass="gridview"
BackColor="#335789"
BorderColor="#133769"
BorderStyle="Solid"
BorderWidth="1px"
EmptyDataText="Sorry,
there are no products that matched your search criteria">
<Columns>
<asp:BoundField
DataField="Id"
HeaderText="Id"
ReadOnly="True"
SortExpression="Id" />
<asp:BoundField
DataField="Name"
HeaderText="Name"
SortExpression="Name" />
<asp:BoundField
DataField="Description"
HeaderText="Description"
SortExpression="Description" />
<asp:BoundField
DataField="Price"
HeaderText="Price"
SortExpression="Price" />
</Columns>
<RowStyle BackColor="White" ForeColor="#436799" />
<HeaderStyle ForeColor="White" />
<PagerStyle ForeColor="White" />
</asp:GridView>
<manu:CompatObjectDataSource
ID="ObjectDataSource1"
runat="server"
DataObjectTypeName="Product"
FilterParameterName="filteredBy"
DeleteMethod="Delete" InsertMethod="Add" OldValuesParameterFormatString="old_
{0}"
SelectMethod="LoadFiltered" TypeName="ProductsDAL" UpdateMethod="Edit"
OnDeleted="ObjectDataSource1_Deleted" OnUpdated="ObjectDataSource1_Updated"
MaximumRowsParameterName="maxRows"
StartRowIndexParameterName="startIndex"
EnablePaging="true"
SelectCountMethod="CountAll"
SortParameterName="sortedBy"
FilterExpression="{0}">
<FilterParameters>
<asp:SessionParameter
Name="filterValue"
SessionField="filteredBy"
/>
</FilterParameters>
</manu:CompatObjectDataSource>
<br
/>
<asp:Label
ID="lbResult" runat="server" EnableViewState="False"></asp:Label>
</asp:Content>