I have a ListView on a page that uses a object data source. I want to be able to add a search box to the page and only show the results that match the search query. Does anyone have a good reference? I'm using C#.
<%@ Page Title="" Language="C#" MasterPageFile="~/Site.master" AutoEventWireup="true"
CodeFile="system.aspx.cs" Inherits="system" %>
<asp:Content ID="Content1" ContentPlaceHolderID="HeadContent" runat="Server">
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="MainContent" runat="Server">
<asp:Label ID="LabelSearch" runat="server" Text="Search: " />
<asp:TextBox ID="TextSearchBox" runat="server" />
<asp:ImageButton ID="ButtonSearchBox" runat="server" ImageUrl="~/Styles/Images/Find.png"
OnClick="ButtonSearchBox_Click" />
<asp:Label ID="LabelSystemCount" runat="server" />
<asp:ListView ID="SystemList" runat="server" DataSourceID="SystemSource" DataKeyNames="SystemID">
<ItemTemplate>
<tr id="row" runat="server" class='<%# Container.DataItemIndex % 2 == 0 ? "row" : "altrow" %>'>
<td>
<%# Eval("Name") %>
</td>
<td>
<%# Eval("Acronym") %>
</td>
<td>
<%# Eval("Description") %>
</td>
<td>
<asp:ImageButton ID="ButtonEdit" runat="server" ImageUrl="~/Styles/Images/Edit.png"
ToolTip="Edit" OnClick="ButtonEdit_Click" />
<asp:ImageButton ID="ButtonDelete" runat="server" ImageUrl="~/Styles/Images/Delete-Red-Cross.png"
ToolTip="Delete" CommandName="Delete" />
</td>
</tr>
</ItemTemplate>
<LayoutTemplate>
<table class="system">
<tr>
<th>
<asp:LinkButton runat="server" Text="System Name" />
</th>
<th>
<asp:LinkButton runat="server" Text="Acronym" />
</th>
<th>
<asp:LinkButton runat="server" Text="Description" />
</th>
<th>
<asp:Label runat="server" Text="" />
</th>
</tr>
<tr id="itemPlaceholder" runat="server" />
</table>
</LayoutTemplate>
</asp:ListView>
<asp:DataPager ID="SystemPager" runat="server" PageSize="10" PagedControlID="SystemList">
<Fields>
<asp:NumericPagerField />
</Fields>
</asp:DataPager>
<asp:ObjectDataSource ID="SystemSource" runat="server" DataObjectTypeName="cipfinModel.System"
DeleteMethod="Delete" SelectMethod="GetSystems" SelectCountMethod="SystemCount"
TypeName="SystemDAO" InsertMethod="Insert" UpdateMethod="Update" EnablePaging="true" />
</asp:Content>