Connecting Tech Pros Worldwide Forums | Help | Site Map

Nested webcontrols from the same objectdatasource - Help needed

Newbie
 
Join Date: Mar 2009
Location: New Zealand
Posts: 10
#1: Apr 21 '09
Hi, I am using these: ASP.Net 2.0, VB.Net, Visual Studio 2005, SQL Server 2005, Objectdatasource using DAL & BLL classes

My objectdatasource can produce below output by CategoryID parameter: (stored procedure: GetProductsByCategoryID )

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
  1. <asp:DataList ID="DataList1" runat="server" DataKeyField="ProductID" DataSourceID="ProductsByCategoryDataSource" RepeatColumns="4" RepeatDirection="Horizontal">
  2.     <ItemTemplate>
  3.          <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>
  4.     </ItemTemplate>
  5. </asp:DataList>
  6. <asp:ObjectDataSource ID="ProductsByCategoryDataSource" runat="server" OldValuesParameterFormatString="original_{0}" SelectMethod="GetProductsByCategoryID" TypeName="ProductsBLL" EnableViewState="False">
  7.     <SelectParameters>
  8.          <asp:QueryStringParameter Name="CategoryID" QueryStringField="CategoryID" Type="Int32" />
  9.     </SelectParameters>
  10. </asp:ObjectDataSource>
But my new requirement is to show the collectionswise (sub headings) products in the outer web control. If it is categorywise, my job will be easier. Because in outer web control, I will get the categorylist and inner web control will take the specific categoryID as parameter to produce the list.

How can I achieve my new requirement? Please help.

Reply

Tags
asp.net 2.0, dal & bllclasses, sql server 2005, vb.net, visual studio 2005