Solved

Selecting Items in Cascading Drop Down List Box

Posted on 2007-11-16
2
3,185 Views
Last Modified: 2008-02-01
I am converting a web site into a .NET AJAX enabled web site.
I am using 5 cascading drop down list boxes so that the user can only select what is appropriate for the item.  They are in order Series, Enclosure, Speed, Manufacturer and Model.  I am storing this information into a database (in text).  When the user goes back in, I want to have these items populated with the previous selections.

How do I do this?

I have the following lines of code (C#):
string series = dtTable.Rows[0]["systemtype"].ToString();
string enclosure = dtTable.Rows[0]["enclosure"].ToString();
string speed = dtTable.Rows[0]["speed"].ToString();
string manu = dtTable.Rows[0]["manufacture"].ToString();
string model = dtTable.Rows[0]["model"].ToString();
DropDownList1.SelectedItem.Text = series;
DropDownList2.SelectedItem.Text = enclosure ;
DropDownList3.SelectedItem.Text = speed ;
DropDownList4.SelectedItem.Text = manu ;
DropDownList5.SelectedItem.Text = model ;
When I bring up the page, nothing is there!

Am I doing something wrong with the CascadingDropDownListBox?  Do I need to do this at a different time than in the Page_Load event?

Thanks in advance for the help!
0
Comment
Question by:ericlockshine
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 

Author Comment

by:ericlockshine
ID: 20305965
I've Solved My own problem here.  I am putting this in the solutions so that other programmers don't have to search everywhere to find it.

The answer is:
Use the CascadingListBox.SelectedValue setting.  Set this equal to one of the selections in the list and you will select that item (after the request comes back from the WebService Call.  Also, be sure that you don't immediatly try to access the DropDownListBox that it is associated with or you may lose your data in the event (likely) that the DDL doesn't have any data just yet.
0
 
LVL 5

Accepted Solution

by:
Netminder earned 0 total points
ID: 20308244
Closed, 500 points refunded.
Netminder
Site Admin
0

Featured Post

SharePoint Admin?

Enable Your Employees To Focus On The Core With Intuitive Onscreen Guidance That is With You At The Moment of Need.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article discusses the ASP.NET AJAX ModalPopupExtender control. In this article we will show how to use the ModalPopupExtender control, how to display/show/call the ASP.NET AJAX ModalPopupExtender control from javascript, how to show/display/cal…
IntroductionWhile developing web applications, a single page might contain many regions and each region might contain many number of controls with the capability to perform  postback. Many times you might need to perform some action on an ASP.NET po…
With Secure Portal Encryption, the recipient is sent a link to their email address directing them to the email laundry delivery page. From there, the recipient will be required to enter a user name and password to enter the page. Once the recipient …
Attackers love to prey on accounts that have privileges. Reducing privileged accounts and protecting privileged accounts therefore is paramount. Users, groups, and service accounts need to be protected to help protect the entire Active Directory …

737 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question