Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7539439
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T07:22:55+00:00 2026-05-30T07:22:55+00:00

I have 2 repeaters that print menu headers and menu items – on inside

  • 0

I have 2 repeaters that print menu headers and menu items – on inside the other.
They look like this:

<asp:Repeater ID="ParentRepeater" runat="server" OnItemDataBound="ParentRepeater_ItemDataBound">
        <ItemTemplate>
            <h2>
                <%#DataBinder.Eval(Container.DataItem, "typenavn") %></h2>
            <asp:HiddenField ID="HiddenField1" Value='<%# Eval("id") %>' runat="server" />
            <asp:Repeater ID="ChildRepeater" runat="server">
                <ItemTemplate>
                    <table>
                        <tr>
                            <td style="width: 200px">
                                <%#DataBinder.Eval(Container.DataItem, "productName") %>
                            </td>
                            <td style="width: 200px">
                                <%#DataBinder.Eval(Container.DataItem, "pris") %>
                            </td>
                            <td>
                                <asp:HiddenField ID="HiddenField2" runat="server" />
                                <asp:TextBox ID="TextBox1" runat="server"></asp:TextBox><br />
                            </td>
                        </tr>
                    </table>
                </ItemTemplate>
            </asp:Repeater>
        </ItemTemplate>
    </asp:Repeater>

It’s all good and fun and works.
But now I need to find the different textboxes – in the textboxes you can write how many of the different menu items you want.
I have tried many different things:

Control myControl1 = FindControl("MainContent_ParentRepeater_ChildRepeater_0_HB1_0");

And this:

foreach (RepeaterItem item in ParentRepeater.Items)
{
    if (item.ItemType == ListItemType.Item)
    {
        TextBox txt = (TextBox)item.FindControl(("MainContent_ParentRepeater_ChildRepeater_0_HB1_0")) as TextBox;
        // do something with "myTextBox.Text"
        break;
    }
}

And this:

foreach (RepeaterItem item1 in ParentRepeater.Items)
{
    if (item1.ItemType == ListItemType.Item || item1.ItemType == ListItemType.AlternatingItem)
    {
        ChildRepeater = (Repeater)item1.FindControl("ChildRepeater");

        foreach (RepeaterItem item2 in ChildRepeater.Items)
        {
            if (item2.ItemType == ListItemType.Item || item2.ItemType == ListItemType.AlternatingItem)
            {
                TextBox txt = (TextBox)item2.FindControl(("ct100$MainContent$ParentRepeater$ct100$ChildRepeater$ct100$HB1")) as TextBox; // MainContent_ParentRepeater_ChildRepeater_0_HB

             }
         }
     }
     break;
 }

And none of it work. Can anybody out there help me?? How do I get hold of my textbox inside the repeater??

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-30T07:22:56+00:00Added an answer on May 30, 2026 at 7:22 am

    The FindControl function should take the ID of the server control, not the rendered client control. You should be able to do this:

    var txt = item.FindControl("TextBox1") as TextBox;
    if (txt != null) 
    {
        // found it!
    }
    

    To adjust your code:

    foreach (RepeaterItem item1 in ParentRepeater.Items)
    {
        if (item1.ItemType == ListItemType.Item || item1.ItemType == ListItemType.AlternatingItem)
        {
            ChildRepeater = (Repeater)item1.FindControl("ChildRepeater");
    
            foreach (RepeaterItem item2 in ChildRepeater.Items)
            {
                if (item2.ItemType == ListItemType.Item || item2.ItemType == ListItemType.AlternatingItem)
                {
                     TextBox txt = (TextBox)item2.FindControl(("TextBox1")) as TextBox;
                }
            }
        }
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

i have a repeater that will output a series of items: <asp:repeater ... runat=Server>
I have an ASP.NET repeater that shows a list of items with a delete
I have an ASP.NET control that binds data to a repeater. Inside that repeater,
I have a webpage looks something like this: <html> ... <div id=menu> ... <ul
I have a repeater that outputs divs like the following for every item returned
I have a repeater that's bound to a SQL Data Source (using ASP.NET). Are
Greetings! I have a Repeater control that's using an XmlDataSource control. <asp:FormView id=myFormView runat=server
I have a program that has this code : #include<stdio.h> main(){ int input; char
I have to write a program in which main calls other functions that test
I have some code that prints out databse values into a repeater control on

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.