Assigning values to objects in a drop down list
Assigning values to objects in a drop down list
Assigning values to objects in a drop down list
Assigning values to objects in a drop down list
Assigning values to objects in a drop down list
Assigning values to objects in a drop down list Assigning values to objects in a drop down list Assigning values to objects in a drop down list Assigning values to objects in a drop down list Assigning values to objects in a drop down list Assigning values to objects in a drop down list Assigning values to objects in a drop down list Assigning values to objects in a drop down list
Assigning values to objects in a drop down list Assigning values to objects in a drop down list
Assigning values to objects in a drop down list
Go Back  Xtreme Visual Basic Talk > > > Assigning values to objects in a drop down list


Reply
 
Thread Tools Display Modes
  #1  
Old 03-18-2011, 05:52 PM
zippeh zippeh is offline
Newcomer
 
Join Date: Mar 2011
Posts: 1
Default Assigning values to objects in a drop down list


Hello,

I'm making a web app for class, and we have to make an app where you can order a pizza online. You have to use a drop down list to pick your size (small, med, large) and each size has a corresponding price (9.99, 12.99, etc).

My question is: How do I assign that price to the correct object in the drop down list?

Thanks.
Reply With Quote
  #2  
Old 03-23-2011, 03:03 PM
DoughBoy DoughBoy is offline
Centurion
 
Join Date: Jun 2006
Posts: 196
Default

Hi zippeh,

Here is a method you could try:

Your Drop-Down Control
HTML Code:
    <asp:DropDownList ID="DD_SizeList" runat="server">
        <asp:ListItem Value="0" Text="Small"></asp:ListItem>
        <asp:ListItem Value="1" Text="Medium"></asp:ListItem>
        <asp:ListItem Value="2" Text="Large"></asp:ListItem>
    </asp:DropDownList>
Code on the server-side
Code:
Dim priceList As Double() = {9.99, 12.99, 15.99} 'And more...
Dim PizzaPrice As Double = priceList(CInt(Me.DD_SizeList.SelectedValue))
There are always more than one way to program... But I hope the above helps you out.
Reply With Quote
Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Forum Jump

Advertisement:





Free Publications
The ASP.NET 2.0 Anthology
101 Essential Tips, Tricks & Hacks - Free 156 Page Preview. Learn the most practical features and best approaches for ASP.NET.
subscribe
Programmers Heaven C# School Book -Free 338 Page eBook
The Programmers Heaven C# School book covers the .NET framework and the C# language.
subscribe
Build Your Own ASP.NET 3.5 Web Site Using C# & VB, 3rd Edition - Free 219 Page Preview!
This comprehensive step-by-step guide will help get your database-driven ASP.NET web site up and running in no time..
subscribe
Assigning values to objects in a drop down list
Assigning values to objects in a drop down list
Assigning values to objects in a drop down list Assigning values to objects in a drop down list
Assigning values to objects in a drop down list
Assigning values to objects in a drop down list
Assigning values to objects in a drop down list Assigning values to objects in a drop down list Assigning values to objects in a drop down list Assigning values to objects in a drop down list Assigning values to objects in a drop down list Assigning values to objects in a drop down list Assigning values to objects in a drop down list
Assigning values to objects in a drop down list
Assigning values to objects in a drop down list
 
Assigning values to objects in a drop down list
Assigning values to objects in a drop down list
 
-->