datatsource depending on other datasource (in datacontrol)

  • Thread starter Thread starter tarscher
  • Start date Start date
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
 
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
 
Back
Top