1

The button names should be added dynamically. A user suggested the solution below (name="@model.id") but the syntax doesn't seem right.

How can I rewrite that HTML attribute (and add the static text "Button" to it)?

**Index.cshtml**

enter image description here

CodeNotFound
  • 22,153
  • 10
  • 68
  • 69
Some One
  • 31
  • 1
  • 7

1 Answers1

4

you are using the wrong keyword.

model is for setting model type

you should be using

@Model.id 

P.S. case sensitive

Steve
  • 11,696
  • 7
  • 43
  • 81
  • I just realized the model was a IEnumerable<> (@model IEnumerable). How can I find a solution because I can't get the ID of each element? – Some One May 09 '18 at 16:00
  • Nevermind, I just found it: https://stackoverflow.com/questions/10598393/asp-net-mvc-3-razor-get-one-element-from-ienumerable. Thank you for your help. – Some One May 09 '18 at 16:03