6.2. Sample Application
In this section you look at an application that does not useASP.NET AJAX to see how it behaves with regard to browser history points and some of the problems they cause. Listing 6-1 (AlbumSearch.aspx), included in the sample code for this chapter, along with Listing 6-2 (AlbumSearch.aspx.cs), is a Web page that allows the user to search for a Phish album by name by typing in a search box and clicking the search button. Search results are displayed in a ListView control, and there are buttons for sorting the results by Title or Release Date.
Example 6-1. AlbumSearch.aspx
<%@ Page Language="C#" CodeFile="AlbumSearch.aspx.cs" Inherits="AlbumSearch" %> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/ TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head runat="server"> <title>Phish Album Search</title> </head> <body> <form id="form1" runat="server"> <asp:TextBox id="txtSearch" runat="server" /> <asp:Button ID="cmdSearch" runat="server" Text="Search" /> <asp:ListView ID="AlbumList" runat="server"> <LayoutTemplate> <p> Sort Order: [<asp:LinkButton ID="SortByTitle" runat="server" CommandName="Sort" CommandArgument="Title" Text="Title" /> | <asp:LinkButton ID="SortByDate" runat="server" CommandName="Sort" CommandArgument="ReleaseDate" Text="Release Date" />] </p> <div id="itemPlaceholder" runat="server"></div> </LayoutTemplate> <ItemTemplate> <div style="font-weight:bold"> <%# Eval("Title") %> ... |
Get Professional ASP.NET 3.5 AJAX now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.