DropDownList AppendDataBoundItems problem

K

Kursat

Hi,

I built a master detail structure with two DropDownLists, one for Countries
(master) and one for Cities (detail). I used SqlDataSource parameters to
built the relation.Users select a country from Countries list and see cities
of that country in the Cities list. I also add "All Cities" static item to
the Cities list and set AppendDataBoundItems property to true so that this
static line appears on top of the list. So far so good but if a user selects
two or more countries repeatedly all cities of selected countries are being
appended to the list. I want only "All Cities" static line and cities of
selected country to be listed.

Is it possible to do so other than manually filling the Cities DropDownList?

Thanks in advance.
 
D

Daniel Rodriguez

Protected Sub DropDownList1_SelectedIndexChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles DropDownList1.SelectedIndexChanged
DropDownList2.Items.Clear()
DropDownList2.Items.Insert(0, "Seleccione aqui")
End Sub

EggHeadCafe.com - .NET Developer Portal of Choice
http://www.eggheadcafe.com
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,989
Messages
2,570,207
Members
46,783
Latest member
RickeyDort

Latest Threads

Top