-1

Can you set a parent tag (Label) with a child data within a nested repeater?

 <asp:Repeater ID="rpDB" runat="server" OnItemDataBound="rpDB_ItemDataBound" EnableViewState="true">
                <ItemTemplate>
                  <label class="glyphicon glyphicon-leaf" /><label id="rbt" runat="server"></label>
                  <asp:Repeater ID="rpDB_item" runat="server" OnItemDataBound="rpDB_item_ItemDataBound">
                                        <ItemTemplate>
                                            <div class="row anj">
                                                <div class="col-md-1 col-xs-1 glyphicon glyphicon-off" id="lblboot" runat="server" title=<%# DataBinder.Eval(Container.DataItem,"boot") %>></div> 
                                              </div>
                                        </ItemTemplate>
                 </asp:Repeater>    
                 </ItemTemplate>
</asp:Repeater>  

I would like to set label rbt in the parent repeater rpDB with the value of the lblboot in the child repeater rpDB_Item. Is this possible, and if so how. I see plenty pulling parent into child but not reversed.

Mike C
  • 63
  • 1
  • 11

1 Answers1

0

Found the answer. I thought I had used this but must have been doing it wrong.
(HtmlGenericControl) mycontrol = (HtmlGenericControl)(e.Item.Parent.Parent.FindControl("myControl"));

This allowed me to set the attributes to a parent control.

Mike C
  • 63
  • 1
  • 11
  • What I don't understand is why would I have to use `....Parent.Parent...` instead of just a single Parent? – Mike C Apr 12 '16 at 20:41