I have a childrepeater with a literal in the headertemplate. When i press a button it activates the close method and I should be able to get the value from that literal.

Any thought on how to access that literal and get the value?

ascx file:

<asp:Repeater runat="server" ID="repParent" OnItemDataBound="repParent_ItemDataBound">
     <ItemTemplate>
        <asp:Panel runat="server" ID="testPanel" Visible="false">
            <div class="form-item">
                <span>
                    <strong>
                          <asp:Literal runat="server" ID="Literal2"></asp:Literal>
                    </strong>
              </span>
            </div>
<asp:Repeater ID="repTest" runat="server" OnItemDataBound="repTest_ItemDataBound">
           <HeaderTemplate>
               <div class="form-item col-1-1">
                     <div class="form-item">
                           <span>
                                <asp:Literal runat="server" ID="LitTest" />
                           </span>
                     </div>
            </HeaderTemplate>
            <ItemTemplate>
               <div class="form-item">
                     <div class="label">
                           <asp:Label runat="server" ID="LabelTest"/>
                     </div>
                     <div class="field">
                           <asp:TextBox runat="server" ID="txtTest"/>
                     </div>
               </div>
            </ItemTemplate>
            <FooterTemplate>
               </div>
            </FooterTemplate>
      </asp:Repeater>
     </asp:Panel>
   </ItemTemplate>
</asp:Repeater>

ascx.cs file:

 protected void Close(object sender, EventArgs e)
    {
        Page.Validate();
        if (Page.IsValid)
        {
          foreach (RepeaterItem item in repParent.Items)
            {
               var rTest = (Repeater)item.FindControl("repTest");
               foreach (RepeaterItem elec in rTest.Items)
              {
                 // GET LIT VALUE
              }
        }
   }

I have tried stuff like:

elec.Controls[0].Controls[0].FindControl("litTest");

But without luck..

Thanks in advance

Related posts

Recent Viewed