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 7677005
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T17:19:36+00:00 2026-05-31T17:19:36+00:00

I think I may have used a repeater when I should have used something

  • 0

I think I may have used a repeater when I should have used something else, so I’m ready to chalk this up to design but I wanted to check with the development community before changing this.

I should also say upfront that I’m using this repeater control within a custom user-control for an aspx page.

My situation is that I have to dynamically display a list of additional parts when a user selects an item. This is similar to an “you might also be interested in” list that you sometimes see during an online checkout.

So the user selects an item to order from a dropdown and up to 4 additional parts can be optionally added.

Currently I’m bringing back that optional part list in a generic list of data-objects and binding it to a repeater control and its textboxes. The textboxes basically list a part description in one box and an option for the user to type in a quantity of how many they want of that item in another textbox.

That all works great.

So to be clear, after the repeater control loads everything and the form is rendered, the users can then type in values in the quantity textboxes.

Since this is all in a user-control, I’m writing a method to gather all this information up, populate a business object and return it to whatever calls it.

I’m having trouble finding the auto-generated textboxes so I can retrieve their values.

I have this sneaking suspicion that I’m doing something obviously wrong in my design. So I wanted to run this by the hive-mind to see what others think 🙂

Here is my markup generated by the repeater control.

<div class="base-container-controls-75pct">         
  <div class="base-container-controls-98pct">
    <div class="base-container-controls-75pct">
       <input name="DownLoadItem1$UxAdditionalParts$ctl01$UxItemNumber" type="text" id="DownLoadItem1_UxAdditionalParts_ctl01_UxItemNumber" class="textbox-readonly-xl" />
    </div>
    <div class="base-container-controls-10pct">
        <input name="DownLoadItem1$UxAdditionalParts$ctl01$UxQuantity" type="text" value="3" id="DownLoadItem1_UxAdditionalParts_ctl01_UxQuantity" class="textbox-md" />
    </div>  
  </div>

  ... more repeating code here, basically the 98pct div above is repeated for each "row" ...

</div>
  • 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-31T17:19:37+00:00Added an answer on May 31, 2026 at 5:19 pm

    I basically figured this out one after piecing some things together, reading various other posts.

    What I was missing was that I need to add [EnableViewState=”True”] to the markup for my repeater. So my markup is below:

    <asp:Repeater ID="UxAdditionalParts" runat="server" OnItemDataBound="UxAdditionalPartsItemDataBound" EnableViewState="True">
        <HeaderTemplate>
        </HeaderTemplate>
        <ItemTemplate>
        <div class="base-container-controls-98pct">
            <div class="base-container-controls-75pct">
                <asp:TextBox ID="UxItemNumber" runat="server" CssClass="textbox-readonly-xl"></asp:TextBox>
            </div>
            <div class="base-container-controls-10pct">
                    <asp:TextBox ID="UxQuantity" runat="server" CssClass="textbox-md"></asp:TextBox>
            </div>  
        </div>
        </ItemTemplate>
        <FooterTemplate>
        </FooterTemplate>
    </asp:Repeater>
    

    Once this was done, I could simply loop through the controls as I expected and grab their values, building my list of objects from them. Here is how that turned out:

    // Find all textboxes, looping through them to build an object list.  Generally there is a maximum of 4 parts
    // associated here but there could be more in the future so this should expand too.
    for (int j = 0; j <= UxAdditionalParts.Items.Count - 1; j++)
        {
            if (UxAdditionalParts.Items[j].ItemType == ListItemType.Item || UxAdditionalParts.Items[j].ItemType == ListItemType.AlternatingItem)
                {
                    TextBox txtItm = (TextBox)UxAdditionalParts.Items[j].FindControl("UxItemNumber");
                    TextBox txtQty = (TextBox)UxAdditionalParts.Items[j].FindControl("UxQuantity");
                    if (txtItm != null & txtQty != null)
                    {
                        // Create a new part and add it to our list.
                        AdditionalPart objAdditionalPart = new AdditionalPart();
                        objAdditionalPart.ItemNumber = txtItm.Text;
                        objAdditionalPart.Quantity = Convert.ToInt32(txtQty.Text) ;
                        loAdditionalParts.Add(objAdditionalPart);
                    }
                }
            } 
    

    Mystery solved!

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I think I may have overlooked something here, but I'm not sure why this
I think I may have misunderstood something here... But here goes. I'm using the
I think this may be relatively straight forward. I have a rewrite rule that
Hopefully this question isn't as subjective as I think it may be. I have
http://pastebin.com/mYk8M038 here is what I have so far... I think it may be something
We have the problem, which I think should be easily resolvable, but just not
Hi I think I may have done this the wrong way round can anyone
I think I may have a misunderstanding of <xsl:variable\> and <xsl:value-of\> so perhaps someone
I think I may have accidently disabled stylecop in my Visual Studio 2008 enviroment.
I think we may have trouble with our existing project. For some reasons we

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.