469,648 Members | 1,618 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,648 developers. It's quick & easy.

Nested webcontrols from the same objectdatasource - Help needed

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.
Apr 21 '09 #1
0 1168

Post your reply

Sign in to post your reply or Sign up for a free account.

Similar topics

4 posts views Thread by V. Jenks | last post: by
2 posts views Thread by Kjetil Klaussen | last post: by
2 posts views Thread by bigbrorpi | last post: by
1 post views Thread by H5N1 | last post: by
1 post views Thread by Chris | last post: by
2 posts views Thread by ASF | last post: by
reply views Thread by gheharukoh7 | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.