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 1498 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.


Updated on 18-Dec-2017
I am a content writter !

Can you answer this question?


Answer

1 Answers

Liked By