<%@
Page Language="C#" MasterPageFile="~/DefaultMaster.master" AutoEventWireup="true" CodeFile="Filtering2.aspx.cs" Inherits="Filtering2" Title="Filtering using individual parameters"
%>
<%@
Register Assembly="ExtendedObjectDataSource" Namespace="Manu.Web.UI.WebControls" TagPrefix="manu" %>
<asp:Content
ID="Content1" ContentPlaceHolderID="Content" Runat="Server">
<h1>Filtering with strongly typed parameters</h1>
id >:
<asp:TextBox
ID="txtFilteredById"
runat="server">0</asp:TextBox>
<asp:RequiredFieldValidator
ID="rfvFilter"
runat="server"
ControlToValidate="txtFilteredById"
Display="Dynamic" ErrorMessage="Please enter a expression to filter
data"></asp:RequiredFieldValidator>
<br
/>
name like:
<asp:TextBox
ID="txtFilteredByName"
runat="server">Product</asp:TextBox>
<asp:RequiredFieldValidator
ID="RequiredFieldValidator1"
runat="server"
ControlToValidate="txtFilteredByName"
Display="Dynamic"
ErrorMessage="Please enter
a expression to filter
data"></asp:RequiredFieldValidator>
<br
/>
<asp:Button
ID="bFilter" runat="server" OnClick="bFilter_Click" Text="Refresh results
with current filter" /><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:ExtendedObjectDataSource
ID="ObjectDataSource1"
runat="server"
DataObjectTypeName="Product"
FilterParameterName="filteredBy"
DeleteMethod="Delete" InsertMethod="Add" OldValuesParameterFormatString="old_{0}"
SelectMethod="LoadFilteredEx" TypeName="ProductsDAL" UpdateMethod="Edit"
OnDeleted="ObjectDataSource1_Deleted" OnUpdated="ObjectDataSource1_Updated"
MaximumRowsParameterName="maxRows" StartRowIndexParameterName="startIndex"
TotalRowCountParameterName="totalRowCount" EnablePaging="True"
SortParameterName="sortedBy" FilterExpression="{0}{1}"
IndividualFilterParameters="True">
<FilterParameters>
<asp:ControlParameter
ControlID="txtFilteredById"
Name="filteredById"
type="Int32"
defaultValue="0"
/>
<asp:ControlParameter
ControlID="txtFilteredByName"
Name="filteredByName"
type="String"
defaultValue="Product"
/>
</FilterParameters>
</manu:ExtendedObjectDataSource>
<br
/>
<asp:Label
ID="lbResult" runat="server" EnableViewState="False"></asp:Label>
</asp:Content>