Is there a way to apply bold styling to the text in the final row using @foreach
in HTML?
I am looking to emphasize the total sum of each column by displaying it in bold text. While I initially considered creating a new table below the current one solely for displaying the totals, I would prefer a solution that allows me to incorporate the totals within the existing table.
Model
//This is the last row
foreach (DataRow item in current2.Tables[0].Rows)
{
var cid2 = new SModel
{
Users = Convert.ToInt32(item["TotalUsers"]),
Rows = Convert.ToInt32(item["TotalRows"]),
Orders = Convert.ToInt32(item["TotalOrders"]),
Customers = Convert.ToInt32(item["TotalCustomers"]),
Quantity = Convert.ToInt32(item["TotalQuantity"]),
};
CASVList.Add(cid2);
}
View
<table>
<thead>
<tr>
<th>Hour</th>
<th>Users</th>
<th>Customers</th>
<th>Orders</th>
<th>Rows</th>
<th>Quantity</th>
</tr>
</thead>
<tbody>
@foreach (var item in Model.SModelObject.CSItem)
{
<tr>
<td>@Html.DisplayFor(modelItem => (item.Text.Split(',')[0]))</td>
<td><b>@Html.DisplayFor(modelItem => (item.Text.Split(',')[1]))</b></td>
<td>@Html.DisplayFor(modelItem => (item.Text.Split(',')[2]))</td>
<td>@Html.DisplayFor(modelItem => (item.Text.Split(',')[3]))</td>
<td>@Html.DisplayFor(modelItem => (item.Text.Split(',')[4]))</td>
<td>@Html.DisplayFor(modelItem => (item.Text.Split(',')[5]))</td>
</tr>
}
</tbody>
</table>
Thank you for your assistance!