Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > ASP.NET and ASP > ASP.NET 2.0 > ASP.NET 2.0 Professional
Password Reminder
Register
Register | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
ASP.NET 2.0 Professional If you are an experienced ASP.NET programmer, this is the forum for your 2.0 questions. Please also see the Visual Web Developer 2005 forum.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the ASP.NET 2.0 Professional section of the Wrox Programmer to Programmer discussions. This is a community of tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developersí questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Reply
 
Thread Tools Display Modes
  #1 (permalink)  
Old December 2nd, 2005, 12:34 PM
Authorized User
 
Join Date: Dec 2003
Location: , , .
Posts: 49
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via MSN to DolphinBay
Default Creating a "Chain" of DropDownLists

Good afternoon to all,

I am tackling the following task and was hoping someone could shed some more light on the subject. I am trying to create a set or chain of dynamic dropdownlists from a SQL DB. The way it would work is that the next dropdownlist in succession would base its values on the previous dropdownlist.

KEY POINTS: Number of dropdownlists will vary. Actual number needed will be retrieved from DB. For example, one Form may have 2 dropdownlists, while another may have 4. Each successive dropdownlist will populate with values based on the previous.

I am sure that you have seen something to this effect on various eCommerce sites. Where once you choose a size of a piece of clothing, the next dropdownlist will populate with the available colors in that size.

Here is the code I have thus far that simply populates all of the dropdownlists at once. Problem is, not all of the options available in DropDownList 2 may be available for the selected option in DropDownList 1. I would be happy with either a VB.NET or a Javascript solution. Many thanks in advance for any and all help.

For Each dr In ds.Tables("options").Rows

Dim ddl As New DropDownList
Dim ltlO As New Literal
Dim ltlC As New Literal

ltlO.Text = vbCrLf & "<div class=""styleData_option""><div_ class=""label"">" & dr("styleOpt_title") & ":</div> <span_ class=""textBox"">" & vbCrLf

ltlC.Text = vbCrLf & "</span></div>" & vbCrLf
ddl.ID = dr("styleOpt_title")
ddl.CssClass = "dropDownList"
ddl.AutoPostBack = True
styleData_optionBasket.Controls.Add(ltlO)
styleData_optionBasket.Controls.Add(ddl)
styleData_optionBasket.Controls.Add(ltlC)

AddHandler ddl.SelectedIndexChanged, AddressOf_ ddl_SelectedIndexChanged

dv = ds.Tables("option_details").DefaultView
dv.RowFilter = "styleOptDtl_styleOptID = " & dr("styleOpt_id")
ddl.DataTextField = "styleOptDtl_title"
ddl.DataValueField = "styleOptDtl_id"
ddl.DataSource = dv
ddl.DataBind()
ddl.Items.Insert(0, New_ ListItem(db.text.database2text(dr("styleOpt_prompt "))))

Next



Dolphin Bay, Inc. -- turning visions into eReality(tm) -- West Palm Beach, FL
Website Design, Internet Strategy, Search Engine Marketing

www.dphin.com
Reply With Quote
  #2 (permalink)  
Old December 2nd, 2005, 06:45 PM
Authorized User
 
Join Date: Dec 2003
Location: , , .
Posts: 49
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via MSN to DolphinBay
Default

Sorry... posted this to the wrong forum. Posting it to ASP.NET 1.x


Dolphin Bay, Inc. -- turning visions into eReality(tm) -- West Palm Beach, FL
Website Design, Internet Strategy, Search Engine Marketing

www.dphin.com
Reply With Quote
Reply


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
Trackbacks are Off
Pingbacks are On
Refbacks are Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
Chain Select Menu with ASP chame Classic ASP Basics 1 May 1st, 2008 06:18 PM
Dropdownlists in DetailsView irelandk BOOK: ASP.NET 2.0 Website Programming Problem Design Solution ISBN: 978-0-7645-8464-0 2 February 20th, 2007 09:13 AM
Creating "chain" of DropDownLists DolphinBay ASP.NET 1.0 and 1.1 Professional 0 December 2nd, 2005 06:45 PM
DropDownLists venterjo General .NET 1 January 8th, 2005 08:10 AM
Mutual authentication & null cert chain exception S M Humayun J2EE 1 September 6th, 2004 02:35 AM



All times are GMT -4. The time now is 09:36 PM.


Powered by vBulletin® Version 3.7.0
Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.