Tag: drop down menu

MVC 3 Cascading DropDownLists

我不知道如何准确地拥有Cascading DropDownLists 我的情景是下一个: 类别有物品和物品的数量取决于企业 我希望有两个DropDownLists,您选择一个Category,当您选择第一个包含该Category中的Items时,将填充下一个DropDownLists,当您选择Item时,将显示包含每个建立的数量的表。 好的,这将是我的ActionResult public ActionResult ItemByClinic(Guid? Item_ID, Guid? Category_ID) { ViewData[“Categories”] = InventoryDb.Categories; if (Category_ID != null) { ViewBag.Category_ID = Category_ID; ViewData[“Items”] = InventoryDb.Items.Where(i => i.Category.ID == Category_ID); if (Item_ID != null) { ViewBag.Item_ID = Item_ID; ViewData[“Inventory”] = InventoryDb.Items.Single(i => i.ID == Item_ID).Inventory; } } return View(); } 然后,我会让我的两个DropDownLists应该将值发布到Item_ID和Category_ID …第一个类别然后是项目 @Html.DropDownList(“Categories”, new […]