It's my first post, hence hello :)
I want to conditionally open and close div. What am I doing wrong?
@foreach (var m in Model.Recipes)
{
if (left)
{
<div class="rec-line">
}
if (left)
{
</div>
}
}
You need to use the escape character to let the razor engine know that <div>
is text by using @:
code:
@foreach (var m in Model.Recipes)
{
if (left)
{
@:<div class="rec-line">
}
if (left)
{
@:</div>
}
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With