Cascading dropdown lists in ASP.NET MVC 5

后端 未结 2 892
一向
一向 2020-12-16 19:33

I am wondering if there\'s some new helper or method introduced in ASP.NET MVC 5 to implement cascading dropdown lists. I know a way to implement cascading dropdownlist beha

2条回答
  •  無奈伤痛
    2020-12-16 19:48

    No, there are no new helpers or methods in MVC 5 to help.

    The Ajax HTML helpers have been largely ignored in the update. There are some things that may help with stuff related to this:

    1. There is a new @Html.EnumDropDownListFor() HTML helper to populate a dropdown from an Enum.
    2. The Attribute routing functionality of the has been improved and now works with the Web API so it is much easier to map URLs to API calls.
    3. You can now pass in html attibutes in the EditorFor Html helper @Html.EditorFor(m => m.FieldName, new { htmlAttributes = new { @class = "form-control" } })

    I implemented cascading dropdowns last week and used the tried and true JSON call you mentioned. I like to use this jQuery plugin in conjunction with the Web API v2 with the new attribute routing.

提交回复
热议问题