<\/script>')

Repeater inside the repeater

I have a repeater inside the repeater, how can I use the following code:

<input type="hidden" value='<%# Container.ItemIndex %>' /> 

pointing to the first repeater?

+4
source share
2 answers

This question is similar; although he talks about accessing a property from <HeaderTemplate> , he feels that he should work with <ItemTemplate> .

So try <%# ((RepeaterItem)Container.Parent.Parent).ItemIndex %>

If this does not work, you may need more .Parent s. Try temporarily binding the ItemDataBound handler to the internal repeater and use the fact that the RepeaterItemEventArgs Item property returns the same object as the Container in aspx. So basically evaluate e.Item.Parent , e.Item.Parent.Parent etc., until you find one that is another RepeaterItem . Then use the same .Parent number in your aspx.

+6
source

From MSDN: How to Display Hierarchical Data Using Nested Repeater Controls

The article is a few years old, but content is what you are looking for.

0
source

Source: https://habr.com/ru/post/1413944/


All Articles