set “id” and “name” for @HtmlEditorFor?

后端 未结 3 1345
[愿得一人]
[愿得一人] 2020-12-16 17:49

I\'m trying to set id and name for @Html.EditorFor, but this isn\'t working:

@H         


        
3条回答
  •  不知归路
    2020-12-16 18:22

     @Html.EditorFor(model => model.Beds[i].BedName, new { htmlAttributes = new { @class = "form-control", Name = "BedName" + Model.Beds[i].bedId, @id = "BedName" + Model.Beds[i].bedId } })
    

    Use Name insted of @name and add htmlAttributes in your code its working for me

提交回复
热议问题