Nested Data List!

A

Adam Knight

Hi all,

I have a datalist which contains another datalist in it selected item
template.
When a particular datalist item is selected i am wanting the nested datalist
control to be data bound.

My problem is i just can find a way to reference this nested data list.
I have been working on this for ages, trying a miriad options with no
success.

Any one got any info to get me past this issue.

Cheers,
Adam
 
G

Guest

Hello Adam

On aspx-page add datalist as follows:

<asp:datalist id="MAINLIST" runat="server" DataKeyField="[DATAKEY NAME]">
<ItemTemplate>
<h1><%# DataBinder.Eval(Container, "DataItem.SOME_FIELD") %></h1>
<asp:datalist ID="CHILDLIST" Runat="server" DataSource="<%#
GetChildList( container.dataitem("PARENT_FIELD"))%>">
<h2><%# DataBinder.Eval(Container, "DataItem.CHILDFIELD") %><h2>
</asp:datalist>
</ItemTemplate>
</asp:datalist>

Add GetChildList-method to codebehind.
GetChildList-method returns other DataTable or DataRows.

Thats quick sample and not tested.
Look also http://www.standardio.org/article.aspx?id=155
 

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

No members online now.

Forum statistics

Threads
473,995
Messages
2,570,230
Members
46,819
Latest member
masterdaster

Latest Threads

Top