Using the ObjectDataSource Control LISTING Show Filtered Movies | 814 CHAPTER 18 Using the ObjectDataSource Control LISTING @ Page Language C DOCTYPE html PUBLIC - W3C DTD XHTML EN http TR xhtml11 DTD html xmlns http 1999 xhtml head id Head1 runat server title Show Filtered Movies title head body form id form1 runat server div asp DropDownList id ddlMovieCategory DataSourceID srcMovieCategories DataTextField Name DataValueField Id Runat server asp Button id btnSelect Text Select Runat server hr asp GridView id grdMovies DataSourceID srcMovies AutoGenerateColumns false Runat server Columns asp BoundField DataField Title HeaderText Movie Title asp BoundField DataField Director HeaderText Movie Director Columns asp GridView asp ObjectDataSource id srcMovieCategories TypeName FilterMovies SelectMethod GetMovieCategories From the Library of Wow eBook Paging Sorting and Filtering Data with the ObjectDataSource Control 815 EnableCaching true CacheDuration Infinite Runat server asp ObjectDataSource id srcMovies TypeName FilterMovies SelectMethod GetMovies EnableCaching true CacheDuration Infinite FilterExpression CategoryID 0 Runat server FilterParameters asp ControlParameter Name Category ControlID ddlMovieCategory FilterParameters asp ObjectDataSource div form body html Both ObjectDataSource controls in Listing have caching enabled. Furthermore the second ObjectDataSource control includes a FilterExpression property that filters the cached data using the selected movie category from the DropDownList control. Both ObjectDataSource controls represent the component in Listing . LISTING 18 using System using using using using public class FilterMovies private readonly string _conString public DataSet GetMovies Initialize connection From the Library of Wow eBook 816 CHAPTER 18 Using the ObjectDataSource Control SqlConnection con new SqlConnection _conString Initialize .