asp.net-mvc-5.2

Why map special routes first before common routes in asp.net mvc?

荒凉一梦 提交于 2019-11-25 23:59:22
问题 From the www: ...The routing engine will take the first route that matches the supplied URL and attempt to use the route values in that route. Therefore, less common or more specialized routes should be added to the table first, while more general routes should be added later on... Why should I map specialized routes first? Someone can give me an example please where I can see the failing of \"map common route first\" ? 回答1: The routing engine will take the first route that matches the

Why does the DropDownListFor lose the multiple selection after Submit but the ListBoxFor doesn't?

浪尽此生 提交于 2019-11-25 23:38:35
问题 I have read many articles about using MultiSelectList and have yet to understand what is going wrong with my DropDownListFor. I have a ListBoxFor with the same View, ViewModel and data that works fine. I want to use the DropDownListFor because of its optionLabel parameter that ListBoxFor doesn\'t have. When the View is first loaded, both the DropDownListFor and the ListBoxFor show the multiple selected items. When the Submit button is clicked, the selected items collection is posted back to