Quantcast
Channel: ASP.NET Core
Viewing all articles
Browse latest Browse all 9386

How to use htmlhelper to create Div contains 'Label' and 'Select'(DropdownList) in MVC 6

$
0
0

1. Need to get the selected items by http uri, e.g. using ajax in view

2. The model key field already has attribute [DataType("DropDownList")] from System.ComponentModel.DataAnnotations

3. Need to execute in MVC6

In MVC5 , it's using Html.EditorFor. 

 @Html.EditorFor(model => model.BroadcastType_Id, new { Id = "BroadcastType_Id", Label = "Broadcast Type", Key = "Id", Value = "Description", Ajax = Url.ApiUrl("~/Broadcast/api/Configuration/TypeActives") })


Use the same code and execute in MVC6, will only generate the 'input' element... Do you know why?


Viewing all articles
Browse latest Browse all 9386

Trending Articles