My objectdatasourc e can produce below output by CategoryID parameter: (stored procedure: GetProductsByCa tegoryID )
CategoryID | CollectionID | ProductID | CategoryName | CollectionName | ProductName | ProductPhoto
1 1 3 XYZ ABC Prod3 Photo3.jpg
1 2 4 XYZ BCA Prod4 Photo4.jpg
In my ASP.Net web page, I can able to show the product list (Photo, and below that the product name) in horizontal mode through datalist web control as per requirement. It is working fine.
ASP.Net page code below:
Expand|Select|Wrap|Line Numbers
- <asp:DataList ID="DataList1" runat="server" DataKeyField="ProductID" DataSourceID="ProductsByCategoryDataSource" RepeatColumns="4" RepeatDirection="Horizontal">
- <ItemTemplate>
- <asp:Image ID="Image1" runat="server" ImageUrl='<%# Eval("Photo") %>' ToolTip='<%# Eval("Description") %>' /><br /><asp:HyperLink ID="ProductIDHyperLink" runat="server" NavigateUrl='<%#String.Format("ProductDetails.aspx?CategoryID={0}&ProductID={1}",DataBinder.Eval(Container,"DataItem.CategoryID"),DataBinder.Eval(Container,"DataItem.ProductID"))%>' Text='<%# Eval("Description")%>'></asp:HyperLink>
- </ItemTemplate>
- </asp:DataList>
- <asp:ObjectDataSource ID="ProductsByCategoryDataSource" runat="server" OldValuesParameterFormatString="original_{0}" SelectMethod="GetProductsByCategoryID" TypeName="ProductsBLL" EnableViewState="False">
- <SelectParameters>
- <asp:QueryStringParameter Name="CategoryID" QueryStringField="CategoryID" Type="Int32" />
- </SelectParameters>
- </asp:ObjectDataSource>
How can I achieve my new requirement? Please help.