Search Results Page

The SearchResults.aspx page displays a list of all products whose names or descriptions match specified search criteria. This page appears when a user clicks the Search button that appears at the top of most pages in IBuySpy. The search form itself is not actually part of the page; instead, it is part of the Header user control ( _Header.ascx ) that is incorporated into the page.

The ProductsList page logic is encapsulated entirely within its Page_Load() method. This event handler is called when the page is accessed by a browser client. The Page_Load() method obtains the text clause to search the product database using the Params collection of the page's Request object.

After parsing the CategoryID parameter into an integer value, the Page_Load() method instantiates a ProductDB class and calls the GetProducts() method. It gives the GetProducts() method an integer argument representing the category ID.

The product collection is displayed using a DataList server control. The DataList server control contains a user-defined ItemTemplate that describes what each item in the list should look like. The data values returned from the ProductsDB.GetProducts() method are populated into the DataList by setting its Datasource property, and then calling its DataBind() method. When DataBind() is called, the DataList will iterate over the DataSource and render a copy of the ItemTemplate for each row, populating data from the row.



ASP. NET Solutions - 24 Case Studies. Best Practices for Developers
ASP. NET Solutions - 24 Case Studies. Best Practices for Developers
ISBN: 321159659
EAN: N/A
Year: 2003
Pages: 175

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net