Razor syntax inside attributes of html elements (ASP MVC 3)

Viewed 23057

I have a table with repeating customer rows, I would like to add the customer ID to the ID attribute of my table rows like this:

<tr id="row<customer id>"></tr>

I try adding this code:

@foreach(var c in Model) {
   <tr id="row@c.id"></tr>
}

Which gives me the following output:

<tr id="row@c.id"></tr>
<tr id="row@c.id"></tr>

etc.

But I would like it to be:

<tr id="row1"></tr>
<tr id="row2"></tr>

etc.

I also tried to add <tr>row@{c.id}</tr> but it did not work..

1 Answers
Related