Can I change the html name generated by Html.DropDownListFor?

前端 未结 9 1626
爱一瞬间的悲伤
爱一瞬间的悲伤 2021-02-05 03:04

IDI am using the following code to create a drop down list:

 @for (var index = 0; index < Model.AdminSummaries.Count(); index++) 
            { 
            &         


        
9条回答
  •  执念已碎
    2021-02-05 03:39

    Just use "Name" instead of "name" and it works.

    @Html.DropDownList("ClassID", null, "Select Class", htmlAttributes: new { id = _id, Name =_id, @class = "form-control" })
    

提交回复
热议问题