Vote count:
0
I have a requirement that if any table column contains no values then to not include the column in the output. This implies quite a few if(){} wrappers around each column which could become tedious, as I have quite a few views to upgrade. However this is what I am doing at present, and wanted to know whether there was a more productive way of putting this feature in?
The header:
@if(myOrders.Any(r=>r.CustomerId!=null)){<th>Customer</th> IsCol1 = true;}
Table body within foreach
@if(IsCol1){<td>@Html.DisplayFor(m => item.CustomerId)</td>}
Thanks.
asked 1 min ago
Aucun commentaire:
Enregistrer un commentaire