ASP.NET  •  Calling All Objects

Listing 3. You can use the ObjectDataSource control to dynamically bind objects returned from methods, such as the GetProducts() method in the ProductsDB class (see Listing 4). This code calls a data-access object directly, but it could just as easily call a business object that in turn calls the data-access object. Notice the simplified Eval("field") syntax, which replaces the version 1.1 DataBinder.Eval(Container.DataItem,"field") syntax in data-binding expressions.

<a href='ProductDetails.aspx?productID=
   <%# Eval("ProductID") %>'>
   <img src='ProductImages/thumbs/
      <%# Eval("ProductImage") %>'
   width="100" height="75" border="0">
</a>

<asp:objectdatasource id=
   "odsProductsDB" runat="server" 
   typename="GolfClubShack.ProductsDB" 
      selectmethod="GetProducts">
   <SelectParameters>
      <asp:QueryStringParameter Type="Int32" 
         Name="categoryID" 
         QueryStringField="CategoryID" 
         DefaultValue="15"/>
   </SelectParameters>
</asp:objectdatasource>