I want to set the width of a div via the style Attribute (to use the div as a bootstrap progress bar. I want to do this in a foreach loop
@foreach (var item in Items)
{
<tr>
<td>@item.Name</td>
<td>
<div class="progress">
<div class="progress-bar" role="progressbar" aria-valuenow="@item.PercentageCompleted" aria-valuemin="0" aria-valuemax="100" style="width: @item.PercentageCompleted;">
</div>
</div>
</td>
</tr>
} `
What happens is that the style attribute is empty. Is there a way to achieve this?
PercentageCompleted? Are they just a number or are they##px,##%etc?styleattribute but it would not be valid - you would need something likestyle="@string.format("width: {0}%;", item.PercentageCompleted)"to make it validstyle="width: 1":)