Click here to Skip to main content
15,890,506 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hello friends.

I want to bind parent repeater item index in child repeater control using inline code not code behind side.

For example:
HTML
<asp:repeater id="parentRep" runat="Server">
   <ItemTemplate>
      <asp:repeater id="parentRep" runat="Server">
         <ItemTemplate>
                  /* Here I want to bind Parent RepeaterItemIndex */
         </ItemTemplate>
      </asp:repeatere>
   </ItemTemplate>
</asp:repeater>

Regard
Imrankhan
Posted
Updated 17-Jun-10 2:45am
v3

1 solution

Hi
You can you following code to get Parent Row Index on Child Control using

<% int parentRowIndex = Container.DataItemIndex; %>

XML
<asp:Repeater ID="parentRep" runat="Server">
                                               <ItemTemplate>
                                                   <%int parentRowIndex = Container.DataItemIndex;  %>
                                                   <asp:Repeater ID="parentRep" runat="Server">
                                                       <ItemTemplate>
                                                           <%parentRowIndex %>
                                                       </ItemTemplate>
                                                   </asp:repeatere>
                                               </ItemTemplate>
                                           </asp:Repeater>



Thanks,
Imdadhusen
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900