nested asp.net repeater with objectdatasource

H

Howard

I need to generated a list from data from 2 database tables.
1st list CATEGORY consists of columns
CATID|CATEGORYNAME|

2nd table ITEM has columns
ID|CATEGORYID|NAME|

<asp:repeater id=parent datasourceid=ds1 runat=server>
<itemtemplate>
<h1><%# Eval("CATEGORYNAME")%></h1><ul>
<asp:repeater id=childdatasourceid=ds2 runat=server>
<itemtemplate>
<li><%# Eval("ID")%>. <%# Eval("NAME")%></li>
</itemteplate>
</asp:repeater></ul>
</itemteplate>
</asp:repeater>

The problem with this is the child repeater doesn't know which instance of
the parent repeater it belongs to.
The output looks like this

Category 1
Item 1 of category 1
Item 2 of category 1
Category 2
Item 1 of category 1
Item 2 of category 1
Category 3
Item 1 of category 1
Item 2 of category 1
....

How do you set up a relationship between the two objectdatasources (CATEGORY
and ITEM)?

The correct html output shoud look like this

Category 1
Item 1 of category 1
Item 2 of category 1
Category 2
Item 1 of category 2
Item 2 of category 2
Category 3
Item 1 of category 3
Item 2 of category 3
....

Thanks,
Howard
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads

Complex nested repeater 0
Nested ListView 6
repeater 0
Only one table shows up with the information 2
Nested DATASOURCES possible??? 0
Nested Repeater within Grid 0
repeater eval problem 2
Repeater question 3

Members online

No members online now.

Forum statistics

Threads
473,763
Messages
2,569,563
Members
45,039
Latest member
CasimiraVa

Latest Threads

Top