-
DropDownList
hi
i have 2 DropDownList :
DDLCategory: the Category to sale
DDLItem: the items that belonging to this Category
whan i select item from DDLCategory - i want that all the items that belonging to this Category will be in the DDLItem
i use :
SelectedIndex, SelectedItem...AND SO ON...AND always i get the first item from DDLCategory
what sohld i need to write?
thanks
-
Re: DropDownList
SelectedIndex\Value\Item will always return the first selected item in the list.
But then again a DropDownList will only allow you to select one item at a time. If you want to be able to select more than one option at a time then you need to use a List control.
If your choice of control is correct then you need to do the following:
1) Set the AutoPostBack property of the DDLCategory control to true.
2) Write a SelectedIndexChanged event handler for DDLCategory. In this hendler write code to clear the items in DDLItem control and populate it with the list of items for the selected category.
3) Populate the DDLItem control with the items for the default Category in the page load event.
~Nikhil