I have two drop downlist in View As follows
@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:
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??