I am trying to do the following:
@foreach(var p in @Model.line_products){
<img class="small_img_@Model.line_products[i].short_name" src="/Content/images/@Model.line_products[i].image_name" />
}
Which isn't working, it renders the text just the way it is, not recognizing the '@'. I found this other post in Stackoverflow, which suggests adding parenthesis in the following way:
@foreach(var p in @Model.line_products){
<img class="small_img_(@Model.line_products[i].short_name)" src="/Content/images/@Model.line_products[i].image_name" />
}
Using this workaround, I get that my id is rendered as small_img_(MODEL ATTRIBUTE). Isn't there a workaround which doesn't require adding specific characters? (such as the parenthesis).