Assign Attribute to @Html.DropdownList

前端 未结 2 1707
时光说笑
时光说笑 2021-01-03 00:10

I want to assign some ID attribute name to my Dropdown list which is using data from the ViewBag as,

ViewBag.Group = new SelectList(group, \"GroupId\", \"Nam         


        
2条回答
  •  孤街浪徒
    2021-01-03 00:45

    You should be using something like this

    @Html.DropDownList("Group",null,new{@id="testID"});
    

    because the data for the DropDownList comes from the ViewBag to name Group

提交回复
热议问题