Click here to Skip to main content
15,898,134 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I have two drop downlist in View As follows

C#
@Html.LabelFor(model => model.CgTnCode , "District")
             @Html.DropDownList("TnDscode",null,new{@id="cmbTnDscode" ,@size="1.2"})
             @Html.LabelFor(model => model.CgTnCode , "Towns")
             @Html.DropDownList("Tncode",null,new{@id="cmbTncode" ,@size="1.2"})


in Controller I have Following list:

SQL
ViewBag.TnDscode = new SelectList(db.Districts, "DsCode", "DsName");
           ViewBag.Tncode = new SelectList(db.Towns,"TnCode","TnName");


Table Structure:
District: DsCode,DsName
Town: TnCode ,TnName, TnDsCode 
where DsCode=TnDsCode


when I will select District related to that district Town should be populated in Town drop downlist:
can anyone help??
Posted
Updated 2-Sep-13 1:10am
v3

1 solution

Hi Priyankavm,

You can refer this link[^] for reference which would help you a bit

Thanks,
R.K.
 
Share this answer
 
Comments
priyankavm 4-Sep-13 7:47am    
thanks RK
♥…ЯҠ…♥ 5-Sep-13 0:43am    
Any time... if it helps you solve the problem then please mark it as answer ;-)

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900