datatsource depending on other datasource (in datacontrol)

T

tarscher

Hi all,

I have a list containing objects. Each object also contains a list of
objects.
e.g.:
A1: B1 - B2 - B3
A2: B1 - B2 - B3 - B4
A3: B1 - B2 -
A4: B1 - B2 - B3

I want to use a datacontrol (repeater, datagrid, ..) to display the
datasource (A) and the list inside the A datasource. What control do I
best use and how can I make this databinding?

Thanks in advance
Stijn
 
E

Eric Theil

Stijn,

It's hard to answer what control is the best to use for your sitution. Here
are some guidelines though. If you're simply displaying the information and
don't have a need to page or edit the results, use a Repeater control,
otherwise, look into a DataGrid or DataView control. Once you've chosen the
appropriate control, you can use a databinding syntax to databind the child
controls:

<asp:Repeater id=testRepater runat=server>
<ItemTemplate>
<tr><td>
Column Name
<asp:Repeater id=childRepeater runat=server DataSource="<%#[Syntax
to retrieve child recods]%>">
<ItemTemplate>...</ItemTemplate>
</asp:Repeater>
</td></tr>
</ItemTemplate>
</asp:Repetaer>

http://msdn2.microsoft.com/en-us/library/aa478959.aspx

Hope that helps.

e
 

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

Members online

Forum statistics

Threads
473,995
Messages
2,570,228
Members
46,818
Latest member
SapanaCarpetStudio

Latest Threads

Top