Pregunta

MVC 5.1

I have the id of a photo in my Model. Model.PhotoId

When I try to mix it into the HTML, there is a failed error message

 <img src="/path/path/@Model.PhotoId.jpg"/>

Now do I tell Razor that the PhotoId has ended and the ".jpg" has begun?

¿Fue útil?

Solución

You can always use the @ character with an argument as well. This is actually my preferred method when mixing razor in.

<img src="/path/path/@(Model.PhotoId).jpg"/>
Licenciado bajo: CC-BY-SA con atribución
No afiliado a StackOverflow
scroll top