Users Pricing

forum

home / developersection / forums / how to apply where clause condition in foreach loop in mvc razor view?

How to apply Where Clause condition in foreach loop in MVC razor view?

Anonymous User 2379 18 Dec 2017

Hi,

Below is my code,

 @foreach (var item in Model)

                        {
                            if (item.Type == "Technical") {
  <a style="margin-bottom:30px" class="text-white contentFontSize" href="@Url.Action("Index", "Question", new { FilterBy = "technology", FilterText = item.Technology, Type = "Technical" })">
                                 <span class="float-left col-md-2" style="padding: 20px; text-transform: uppercase">@item.Technology &nbsp;&nbsp; @item.TotalCount </span>
                            </a>
   }
                        }

I want to write my conditional statement in foreach loop. It is possible to write a conditional statement with foreach loop. If yes please give me some idea.


I am a content writter !


1 Answers