multiple dropdownlist controls for order items

On the order confirmation page for an ecommerce site, I am putting together a file upload control for customer to upload graphic files for the order. I've got a dropdownlist that pulls a print location from each order item  and adds that location to the file name as it is uploaded. One of the things I'm having trouble with is getting the dropdown list to repeat for each order item. It will do it for only the first item. How can I get it to repeat?
Here is the current code:
foreach (OrderItem item in _Order.Items)


            if (item.Inputs.Count > 0)
             
                 
           {
               DropDownListTemplateFields.DataSource = item.Inputs;
               DropDownListTemplateFields.DataBind();
               DropDownListTemplateFields.Items.Insert(0, " - Select Print Location From List - ");
               DropDownListTemplateFields.Items.Add("One File for all Print locations");
               DropDownListTemplateFields.Items.Add("Sound File(s)");
             
            }

upload.gif
jmestepAsked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

tiagosalgadoCommented:
You can use ASP.NET Repeate Control for that.
http://www.sitepoint.com/article/asp-net-repeater-control/
 
0
jmestepAuthor Commented:
Duh, I should have thought of that. I am also trying to show the product name, then the ddl, then next product name, then ddl. That might be a way to do both- use the header. I'll try tomorrow and post back.
Thanks,
0
tiagosalgadoCommented:
Yes, in Repeater control, you can include all information that you want to repeat.
0
CompTIA Cloud+

The CompTIA Cloud+ Basic training course will teach you about cloud concepts and models, data storage, networking, and network infrastructure.

jmestepAuthor Commented:
Now the page can't find the dropdown list:
<asp:Repeater ID="OrderItemRepeater" runat="server" EnableViewState="true">
             <ItemTemplate>  
            <asp:DropDownList ID="DropDownListTemplateFields" Visible="true" runat="server"  DataTextField="Name" DataValueField="OrderItemInputId"  EnableViewState="true">
            <asp:ListItem Value="" Text=""></asp:ListItem>
            </asp:DropDownList>
            </ItemTemplate>

            </asp:Repeater>
0
tiagosalgadoCommented:
To get all dropdownlists in your reapeter you need to do this

string _value = "";
        foreach (RepeaterItem item in OrderItemRepeater.Items)
        {
            DropDownList d = item.FindControl("DropDownListTemplateFields") as DropDownList;
            if (d != null)
            {
                _value = d.SelectedValue;
            }
 
        }

Open in new window

0
jmestepAuthor Commented:
I think I'm making progress.
Later on in the class, I use the value selected in the dropdown list and I've got an error there

 protected void UploadButton_Click(object sender, EventArgs e)
    {
        bool success = true;
        if (UploadedFile.HasFile)
        {
            if (UploadedFile.PostedFile.ContentLength < 204800000)//195MB
            {
                string selectedItem = DropDownListTemplateFields.SelectedItem.Text;
How can I pick up the value now? I've tried _value and d.SelectedItem.Text

Thanks
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
jmestepAuthor Commented:
I think what I need to do is move the code that validates the upload out of the button click and then put code on each button click that is generated within the repeater to call it?
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
ASP.NET

From novice to tech pro — start learning today.