jeudi 5 février 2015

lambda expression : get a property based on another property


Vote count:

0




I am trying to build HTML in my view :



<div class="row contentHeaderInfo">
@foreach (var groupedItems in Model.DSet.GroupBy(a => new {a.rowId, a.columnId}))
{
<ul>
@foreach (var item in groupedItems)
{
<li>@item.Label @item.labelValue</li>
}
</ul>
}
</div>


For certain labelValues I want to put them inside an <a> tag.


For example If @item.Label = "zip" then



<li>@item.Label <a href ="blah"> @item.labelValue </a></li>


Is it possible to achieve this with lambda expression?



asked 21 secs ago

BumbleBee

2,148






lambda expression : get a property based on another property

Aucun commentaire:

Enregistrer un commentaire