Help on dropdown list

Posted by Vijayar under C# on 5/5/2011 | Points: 10 | Views : 1267 | Status : [Member] | Replies : 7
Hi

In a form there is one dropdown.To the dropdown i am binding both the country names and state names of the particular country from 2 tables i.e.country and state .Now when i click on insert button by selecting values in dropdown state id should be inserted into state table and country id into country table.Please help me on this issue

vijaya


Responses

Posted by: T.saravanan on: 5/5/2011 [Member] [MVP] Silver | Points: 25

Up
0
Down
Hi,

which one is selected from dropdown 'State' (or) 'Country' ?


Thanks,
T.Saravanan

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

Posted by: Vijayar on: 5/5/2011 [Member] Starter | Points: 25

Up
0
Down
we will select Country fro dropdown
Regards
Vijaya

vijaya

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

Posted by: T.saravanan on: 5/5/2011 [Member] [MVP] Silver | Points: 25

Up
0
Down
Based on country selection are you store all the state into database in single row (or) multiple row.
Your requiremnet is not clear to me.Can you brief?

Thanks,
T.Saravanan

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

Posted by: Vijayar on: 5/5/2011 [Member] Starter | Points: 25

Up
0
Down
The information looks lke
Country1
State1
state2
Country 2
State1
-----
when i select country1 and select any one among the states of the country i,need to save that particular country id into countries table and state id into state table .am i clear .Please help me in this issue

vijaya

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

Posted by: T.saravanan on: 5/5/2011 [Member] [MVP] Silver | Points: 25

Up
0
Down
How will you select muliple values from dropdownlist?
Are you using any multiple dropdownlist?

If you need multiple select dropdown means refer this link..
http://www.codeproject.com/KB/user-controls/MultiSelectDropdownList.aspx

Thanks,
T.Saravanan

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

Posted by: Vijayar on: 5/6/2011 [Member] Starter | Points: 25

Up
0
Down
Hi
I am using a single dropdown to bind values from 2 tables i.e states and cities The information looks like
Country1
State1
state2
Country2
State1
State2
Now when i select country1 and state2 of the country their id's should be inserted into country and state id into state

vijaya

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

Posted by: T.saravanan on: 5/6/2011 [Member] [MVP] Silver | Points: 25

Up
0
Down
Hi,
Assume if user select any State from dropdownlist...
Refer this code...
DataTable dtData = new DataTable();

//dtData --> Its have both All Country & State Name
//This DataTable columns like StateCode,StateName,CountryCode,CountryName
string sFilterCond=string.Format("StateId='{0}'",ddlList.SelectedValue.ToString());
//Based on StateCode filter the data from dtData
DataTable dtFilter = dtData.Select(sFilterCond).CopyToDataTable();.

In dtFilter you have Country Code and State Code.Just pass that value into your tables

Thanks,
T.Saravanan

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

Login to post response