KnowledgeHub
Questions
Tags
Users
Search
Alex Rivera
|
Logout
Edit Question
Title
Body
I have two dropdownlist. The selected value from the first one loads the other. How do I do that when I have the helper methods in a controller? @using (Html.BeginForm()) { <div> <table width="100%" cellpadding="0" cellspacing="0"> <tr> <td><b>Select a District:</b></td> <td>@Html.DropDownListFor(m => m.DistrictId, ViewData["DMManagers"] as IEnumerable<SelectListItem>, "Select One")</td> </tr> <tr> <td><b>Select a TM:</b></td> <td>@Html.DropDownListFor(m => m.TMId, ViewData["TMManagers"] as IEnumerable<SelectListItem>, "Select One")</td> </tr> </table> </div> } private void LoadDistrictManagers() { var _DMS = (from c in SessionHandler.CurrentContext.ChannelGroups join cgt in SessionHandler.CurrentContext.ChannelGroupTypes on c.ChannelGroupTypeId equals cgt.ChannelGroupTypeId where cgt.Name == "District Manager" select new { c.ChannelGroupId, c.Name }).OrderBy(m => m.Name); ViewData["DMManagers"] = new SelectList(_DMS, "ChannelGroupId", "Name"); } private void LoadTerritoryManagers(int districtId) { var _TMS = (from c in SessionHandler.CurrentContext.ChannelGroups join cgt in SessionHandler.CurrentContext.ChannelGroupTypes on c.ChannelGroupTypeId equals cgt.ChannelGroupTypeId where cgt.Name == "Territory" && c.ParentChannelGroupId == districtId select new { c.ChannelGroupId, c.Name }).OrderBy(m => m.Name); ViewData["TMManagers"] = new SelectList(_TMS, "ChannelGroupId", "Name"); } public ActionResult SummaryReport() { DistrictManagerModel model = new DistrictManagerModel(); LoadDistrictManagers(); return View("AreaManager", model); }
Tags (comma-separated)
Save Edits
Cancel