dynamic DropDownList custom control

W

will

hi,

i'm trying to create two custom DropDownLists, DropDownList_Countries
and DropDownList_Cities

in DropDownList_Countries, i have a

public override void DataBind()
{
.....
}

which runs a SQL query, and eventually base.DataBind();


in DropDownList_Cities, i have a similar setup but the SQL query
includes a condition which is from the selection of
DropDownList_Countries. eg

"SELECT * FROM tbl_cities WHERE country='" +
DropDownList_Countries.SelectedItem.Value + "';"


what i'm trying to achieve is to display two dropdownlists on a webpage,
DropDownList_Countries has a list of options while DropDownList_Cities
is empty. as soon as something's selected in DropDownList_Countries,
this control does a autopostback and at this point, DropDownList_Cities
should have a list of options derived from the selected country.

however, i can't build this .dll, it says DropDownList_Countries cannot
be found. obviously DropDownList_Countries.SelectedItem.Value is not the
correct way to express the selected value. what shoud i do?

thanks

will.
 

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,755
Messages
2,569,536
Members
45,015
Latest member
AmbrosePal

Latest Threads

Top