473,224 Members | 1,574 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,224 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 3766
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...
1
isladogs
by: isladogs | last post by:
The next online meeting of the Access Europe User Group will be on Wednesday 6 Dec 2023 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, Mike...
0
by: veera ravala | last post by:
ServiceNow is a powerful cloud-based platform that offers a wide range of services to help organizations manage their workflows, operations, and IT services more efficiently. At its core, ServiceNow...
0
by: VivesProcSPL | last post by:
Obviously, one of the original purposes of SQL is to make data query processing easy. The language uses many English-like terms and syntax in an effort to make it easy to learn, particularly for...
0
by: mar23 | last post by:
Here's the situation. I have a form called frmDiceInventory with subform called subfrmDice. The subform's control source is linked to a query called qryDiceInventory. I've been trying to pick up the...
0
by: abbasky | last post by:
### Vandf component communication method one: data sharing ​ Vandf components can achieve data exchange through data sharing, state sharing, events, and other methods. Vandf's data exchange method...
0
by: stefan129 | last post by:
Hey forum members, I'm exploring options for SSL certificates for multiple domains. Has anyone had experience with multi-domain SSL certificates? Any recommendations on reliable providers or specific...
0
Git
by: egorbl4 | last post by:
Скачал я git, хотел начать настройку, а там вылезло вот это Что это? Что мне с этим делать? ...
1
by: davi5007 | last post by:
Hi, Basically, I am trying to automate a field named TraceabilityNo into a web page from an access form. I've got the serial held in the variable strSearchString. How can I get this into the...
0
by: MeoLessi9 | last post by:
I have VirtualBox installed on Windows 11 and now I would like to install Kali on a virtual machine. However, on the official website, I see two options: "Installer images" and "Virtual machines"....

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.