how to link two dropdownlist in visual using csharp
i need a code that link two dropdownlist..for example if i select document1 in first dropdownlist that list the sub topics of that document in next dropdownlist...
Know the answer? Post it — somebody with the same question will find it here.
Sign in to answer this question
It is the same account you read, post and publish with — and you will come straight back to this page.
Pankaj PandeyPosted May 30, 2013, 7:06 AM
http://www.codeproject.com/Articles/38231/Simple-Way-to-Implement-Country-State-City-Dropdow
http://www.c-sharpcorner.com/uploadfile/rohatash/dropdownlist-with-country-state-and-city-in-asp-net/
Pankaj PandeyPosted May 30, 2013, 7:04 AM
try any one of them
http://www.itorian.com/2013/02/cascading-dropdownlist-in-aspnet-mvc.html
or
follow given concept, but you need to write the codes..
lets assume first table is state and second is district --
you must need to relate both table by any one column(here is by state_id)
state table
state_id statename
1 abc
2 def
districts table
districts_id districts state_id
1 xyz 1
2 hhh 1
3 kkkk 2
you can get districts by following query
select districts from tbl_districts where state_id =(select state_id from tbl_state where statename=@statename)
you need to pass statename to @statename from first ddl.
and these data you need to store in datatable and bind it to second DDL