Help on dropdown list1

Posted by Vijayar under ASP.NET on 5/18/2011 | Points: 10 | Views : 1481 | Status : [Member] | Replies : 2
HI

.I Have one dropdown list and 2 tables by name country and state with the following fields
Country ------->Country id,Country Name
State-------------->stateid,country id,statename where country id foreign key in state table
Now i want to bind the data to one dropdownlist with country names in bold and states in normal first,after selecting state the combination of state and city what we selected should appear along with the other data( remaining Countries and states).And when i click on save button the id's of selected state and country should be saved into a table(second table)

Ex
Country1 India
State1 Ap
State2 Bihar
Country2 America
State1 Washington
state2 Mexico

------
If we select India as country and Ap as state in the dropdown should look like India-Ap . I am using code
string selecteditem = DropDownList1.SelectedItem.Text;
DropDownList1.Items.Clear();
string s = cntry.Text + "-" + selecteditem;

DropDownList1.Items.Add(s); to get the combinations
i am able to add at the end but my requirement is the combination should be in selected mode followed by other counries and states.i am not getting it.Please help me in this issue
to solve this issue.it's very urgent

vijaya


Responses

Posted by: Jayakumars on: 9/29/2012 [Member] [MVP] Bronze | Points: 25

Up
0
Down
hi

try this code


DropDownList1.selecteditem.Text;



Mark as Answer if its helpful to you

Vijayar, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Jayakumars on: 9/29/2012 [Member] [MVP] Bronze | Points: 25

Up
0
Down
hi
Please mark as answer if it helpful to you.

Mark as Answer if its helpful to you

Vijayar, if this helps please login to Mark As Answer. | Alert Moderator

Login to post response