Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > ASP .Net Web Controls > ASP.NET 2.0 Drop Down List controls

Thread Tools

ASP.NET 2.0 Drop Down List controls

Geoff Taylor
Posts: n/a
I have three drop down list controls on an 2.0 page. The first
drop down list displays a list of continents, the second displays a
list of countries and the third displays a list of provinces. All
three drop down lists are fed by data sources that use stored
procedures. The stored procedure for filling the Countries drop down
list uses a parameter for filtering the countries that should fill the
list, and the value for that parameter comes from the value of the
currently selected item in the Continents drop down list.

The provinces control is implemented in a similar way. It has a stored
procedure which takes a parameter to filter which provinces to
display. The value of the parameter comes from the value of the
selected country in the Countries drop down list.

So: The filter for provinces depends on the item selected for a
country. And the filter for countries depends on the item selected as
a continent. My problem is that I can change a continent by selecting
a new one in that drop down list, which in turn updates the list of
items available in the countries drop down list, BUT the provinces
drop down list is not updated to reflect the fact that the countries
list has changed because the continents list changed.

I was hoping that a series of controls which have a chain of
dependencies on each other would be smart enough to update properly,
but that does not appear to be so. Is there anything simple that I am
missing here. Maybe I need to handle an event of some sort and
implement a bit of server-side code to properly update the controls,
but I was hoping not.

The first time I run the page I get these values as the first entries
in the drop down lists:
Continent = Africa, Country = Algeria, Province = Adrar

If i then change the continent to Europe, I get:
Continent = Europe, Country = United Kingdom, Province = Adrar - so
the province totally missed the fact that the country has changed.

Any ideas anyone?

Thanks in advance,

Geoff Taylor

Code is below:

<table width="100%" cellspacing="0" cellpadding="0" border="0">
<table width="100%"
cellspacing="0" cellpadding="0" border="0">
<tr><td colspan="8"
<td nowrap
<td nowrap
ID="Step1" Runat="server" ImageUrl="~/Img/step1.gif" />

style="position : relative; top : -5px;"

<aspropDownList ID="DropDownListContinents" Runat="server"

DataTextField="ContinentName" DataValueField="pkContinentID"


<asp:SqlDataSource ID="SqlContinents" Runat="server"

ConnectionString="<%$ ConnectionStringsBConnString %>">


<aspropDownList ID="DropDownListCountries" Runat="server"

DataTextField="Country" DataValueField="pkCountryID"


<asp:SqlDataSource ID="SqlCountries" Runat="server"

ConnectionString="<%$ ConnectionStringsBConnString %>">


<asp:ControlParameter Name="Continent" Type="Int32"




<aspropDownList ID="DropDownListProvinces" Runat="server"

DataTextField="Province" DataValueField="pkProvinceID"


<asp:SqlDataSource ID="SqlProvinces" Runat="server"

ConnectionString="<%$ ConnectionStringsBConnString %>">


<asp:ControlParameter Name="Country" Type="Int32"



Reply With Quote

Thread Tools

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

Similar Threads
Thread Thread Starter Forum Replies Last Post
Affecting a dynamically created drop down from another dynamically created drop down. msimmons ASP .Net 0 07-16-2009 03:17 PM
retrive preselected value in second drop down list from the first drop down list weiwei ASP .Net 0 01-05-2007 07:29 PM
Multiple select drop down poplulating sub drop down Javascript 3 11-09-2006 07:50 PM
Auto Drop down a Drop Down List Javascript 5 11-23-2005 01:35 AM
New to .NET, can I have one drop down box control the data of another drop down box using a database? SirPoonga ASP .Net 2 01-07-2005 10:44 PM