How to override the “name” HtmlAttribute of Razor

前端 未结 2 1101
暗喜
暗喜 2021-02-13 12:37
    @Html.RadioButtonFor(Model => Model.Location, \"Location\")
    @Html.LabelFor(Model=>Model.Location,\"Location\")
    @Html.RadioButtonFor(Model=>Model.Mod         


        
2条回答
  •  小鲜肉
    小鲜肉 (楼主)
    2021-02-13 12:43

    Use the function without "for", then you can specify the name:

    @Html.RadioButton("newname", "value", new { @id="oldname" })
    

提交回复
热议问题