Razor 如何设置剃须刀下拉列表的id

Razor 如何设置剃须刀下拉列表的id,razor,Razor,我不习惯使用剃须刀,我想知道如何给出我的下拉列表和“俱乐部”的id 这是我的视图,其中包含要设置id的下拉列表 <div> <h3 class="text-primary">Select your team</h3> @Html.DropDownList("ClubID", String.Empty) </div> 选择你的团队 @DropDownList(“ClubID”,String.Empty) 使用此方法 public

我不习惯使用剃须刀,我想知道如何给出我的下拉列表和“俱乐部”的id

这是我的视图,其中包含要设置id的下拉列表

<div>
    <h3 class="text-primary">Select your team</h3>
    @Html.DropDownList("ClubID", String.Empty)
</div>

选择你的团队
@DropDownList(“ClubID”,String.Empty)
使用此方法

public static MvcHtmlString DropDownList(
    this HtmlHelper htmlHelper,
    string name,
    IEnumerable<SelectListItem> selectList,
    IDictionary<string, object> htmlAttributes
)

如果不需要选项,可以将第二个参数空列表
(new list()
)替换为包含项的列表。

谢谢,这正是我要找的
@Html.DropDownList("ClubID",new List<SelectListItem>(),new { id="lstClub"})
<select id="lstClub" name="ClubID"></select>