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

  • Home
  • SEARCH
  • 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 6974971
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T17:18:25+00:00 2026-05-27T17:18:25+00:00

I am making a menu for a cafe. It shows the food and rinks

  • 0

I am making a menu for a cafe. It shows the food and rinks items, the price and then I want a textbox, where people can write how much of each they want to buy, shown in a textbox. Then I want each textbox to have a unique ID based on the menu items ID.

This is my repeater:

<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: 400px">
                                <%#DataBinder.Eval(Container.DataItem, "productName") %>
                            </td>
                            <td style="width: 400px">
                                <%#DataBinder.Eval(Container.DataItem, "pris") %>
                            </td>
                            <td>
                                <asp:TextBox ID="TextBox1" runat="server"></asp:TextBox>
                            </td>
                        </tr>
                    </table>
                </ItemTemplate>
            </asp:Repeater>
        </ItemTemplate>
    </asp:Repeater>

And this is my code behind:

protected void ParentRepeater_ItemDataBound(object sender, RepeaterItemEventArgs e)
    {
        RepeaterItem item = e.Item;

        if (item.ItemType == ListItemType.Item || item.ItemType == ListItemType.AlternatingItem)
        {
            Repeater ChildRepeater = (Repeater)item.FindControl("ChildRepeater");

            HiddenField hide = e.Item.FindControl("HiddenField1") as HiddenField;
            int id = Convert.ToInt32(hide.Value);

            var query = from es in gr.products
                        where es.typeID == id
                        select es;

            List<product> list = new List<product>();
            foreach (product pro in query)
            {
                list.Add(pro);
            }

            ChildRepeater.DataSource = list;
            ChildRepeater.DataBind();

            int h = 0;

            foreach (RepeaterItem item1 in ChildRepeater.Items)
            {
                if (item1.ItemType == ListItemType.Item || item1.ItemType == ListItemType.AlternatingItem)
                {
                    TextBox txt = (TextBox)item1.FindControl("TextBox1") as TextBox;
                    HiddenField hf = (HiddenField)item1.FindControl("HiddenField2") as HiddenField;

                    for (int i = 0; i < list.Count; i++)
                    {
                        txt.ID = "HB" + list[h].id.ToString();
                        hf.Value = list[h].id.ToString();
                        h++;
                        break;
                    }
                }
            }
        }
    }

Anybody got any ideas about how to find the textbox??

  • 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-27T17:18:26+00:00Added an answer on May 27, 2026 at 5:18 pm

    You have to search for the TextBox in the RepeaterItem. So you either handle the inner Repeater’s ItemDataBound event or you simply iterate all RepeaterItems:

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

Sidebar

Related Questions

I'm making a game and in the menu I want to display the text
I'm making a very basic menu but I can't seem to get it to
Is there a built-in Android icon for open or load? I'm making menu items,
I am making a customized menu, with customized menu Items. Changing control templates and
I am making a navigational menu in html and css, but i want the
I have a making a menu on a webpage and can't seem to get
I'm making a menu in jquery. You can see it at http://mywash.dk/testtest/index.html The submenu
I'm making a menu in jquery. You can see it at http://mywash.dk/testtest/index.html The submenu
I'm making a menu, and I want one of the buttons to respond when
I'm making a menu with <ul> / <li> and CSS. Here's what I have

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.