473,320 Members | 1,580 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,320 software developers and data experts.

Nested Repeaters

Hi

in nested repeaters, how do I access data in the "outer" repeater from the
"inner" repeater?

For example, I have an ArrayList of RegionMenuItem objects. These objects
contain a Region object, and an ArrayList of Region objects.
I want to display this hierarchy, and in the inner ArrayList of Region
objects I need to access the Id field of the parent Region object.

<asp:repeater id="outer" runat="server">

<ItemTemplate>
<%# ((RegionMenuItem)Container.DataItem).FromRegion.Na me %> <br>

<asp:repeater id="inner" runat="server" DataSource='<%#
((RegionMenuItem)Container.DataItem).ToRegions %>'>
<ItemTemplate>
&nbsp; <%# ((Region)Container.DataItem).Name %> + <%# outerrepeater
region id %> ??? how this ???
</ItemTemplate>
</asp:repeater>

<ItemTemplate>

</asp:repeater>
Thanks for any help,
Peter

Dec 5 '05 #1
1 3771
Hi,
Interesting situation. Obviously you cannot use Container.DataItem to refer
to the parent.
I would keep a reference to the parent Container.DataItem in a protected
variable declared in the code behind. This variable is accesible to the
inner repeater. so the only thing you need to do is update it when the
external repeater bind the data, like :
<asp:repeater id="outer" runat="server">

<ItemTemplate>
<%# KeepReference( Container.DataItem ) %>

<asp:repeater id="inner" runat="server" DataSource='<%#
((RegionMenuItem)Container.DataItem).ToRegions %>'>
<ItemTemplate>
<%# ((Region) OuterReferenceToItem).Name %>
</ItemTemplate>
</asp:repeater>
in the code behind:
protected object OuterReferenceToItem;
protected void KeepReference ( object o ) { OuterReferenceToItem = o; }
cheers,

--
Ignacio Machin,
ignacio.machin AT dot.state.fl.us
Florida Department Of Transportation

"Peter Kirk" <pk@alpha-solutions.dk> wrote in message
news:O7****************@tk2msftngp13.phx.gbl...
Hi

in nested repeaters, how do I access data in the "outer" repeater from the
"inner" repeater?

For example, I have an ArrayList of RegionMenuItem objects. These objects
contain a Region object, and an ArrayList of Region objects.
I want to display this hierarchy, and in the inner ArrayList of Region
objects I need to access the Id field of the parent Region object.

<asp:repeater id="outer" runat="server">

<ItemTemplate>
<%# ((RegionMenuItem)Container.DataItem).FromRegion.Na me %> <br>

<asp:repeater id="inner" runat="server" DataSource='<%#
((RegionMenuItem)Container.DataItem).ToRegions %>'>
<ItemTemplate>
&nbsp; <%# ((Region)Container.DataItem).Name %> + <%# outerrepeater
region id %> ??? how this ???
</ItemTemplate>
</asp:repeater>

<ItemTemplate>

</asp:repeater>
Thanks for any help,
Peter

Dec 5 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: DonRex | last post by:
Hello all! I couldn't find a web application-newsgroup for ASP.NET, so I'm sorry if this is the wrong forum! Synopsis: In my webform I have 3 nested repeaters: rpWeeks ----- rpTime
0
by: Machi | last post by:
let say in parent-child scenerio (Product: Product Category - one product category may has many products), i am using nested repeaters where parent repeater will be used to display info and child...
0
by: kettch | last post by:
Is it possible to have nested repeaters three layers deep I have gotten it to work with only two, and when I tried to get the third layer to work COD <asp:repeater id="rep"...
2
by: Matt Jensen | last post by:
Howdy I have 2 repeaters on a C# page, 1 nested under the other. In some cases, the nested repeaters <ItemTemplate> does not contain rows - how does one display a text message in place of the...
1
by: mavrick_101 | last post by:
Hi, I have nested repeaters. But the page breaks if I refresh 2 or 3 times. It breaks with the following error message.. "Timeout expired. The timeout period elapsed prior to obtaining a...
4
by: =?Utf-8?B?SmFtZXMgR2V1cnRz?= | last post by:
On my page, I have one repeater that contains a literal control and a nested repeater. The nested repeater contains a literal control. Both repeaters are databound with only one object (string). ...
2
by: Josh | last post by:
I have a nested repeater situation with a Link Button on the nested repeater. However when the link button is clicked I get a postback but the event never takes place. I'm trying to wire up the...
1
PrinsonG
by: PrinsonG | last post by:
My Query is How do I export to excel/csv using Nested Repeaters. My project is web-based and i am using C#.Net. In this i use three repeaters. one displays ID, Name of the user. second...
1
by: andrew.douglas11 | last post by:
Hello all, Is it possible to share controls inside a child repeater? Here's the situation: I have a web page that needs to display data grouped by A, and alternatively by B (only one grouping...
3
by: Leon Mayne | last post by:
If I have a datatable which looks like this: Record Id, Group Id, Name 1, 1, Test 1 2, 1, Test 2 3, 2, Test 3 4, 3, Test 4 Is it possible to use nested repeaters to group the information by...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.