ASP.Net Razor Syntax for using a variable in html or html attribute
Because I always forget how to do this, here's a quick note on the Razor syntax in an html variable. For a integer variable named: imgWidth that has a value of 214 you can put it in an html attribute like this:
<div style="width: @(imgWidth)px;">
and it will render like this:
<div style="width: 214px;">
I know I know. The css gurus will be lambasting me that I put inline styles in this example. So sue me. Sometimes inline styles are necessary.