I'm trying to dynamically set an attribute(data-status) for a div if a condition is met.
I am currently using the @Html.Raw helper however it's not making its way in to the element.
I have also attempted to use Response.Write() however it just writes everything to the top of the page.
Is there a best way to actually embed this in to the code or maybe create/set a new attribute?
@foreach (var r in Model)
{
<div class="marker"
data-date="@r.date_finished"
data-name="@r.name"
@if (r.complete == "CP")
{
@Html.Raw("data-status='complete'");
}
>
</div>
}