Developer forum

Forum » Templates » Sort loop in razor

Sort loop in razor

Ricardo Pedra
Reply

Hi,

How can I sort a loop filter alphabetically in razor? 

My code:

<fieldset>

  <legend><!--@Translate(WL_str_material, "Material")-->:</legend>
  <div class="hide">
    @foreach (LoopItem i in GetLoop("Ecom:Filters.ProductFields.Rows")){
      <label for="@i.GetValue("Filters:Current.TagName")_@i.GetValue("Ecom:Filters.ProductFields.Row.Value")">
        <input id="@i.GetValue("Filters:Current.TagName")_@i.GetValue("Ecom:Filters.ProductFields.Row.Value")" name="@i.GetValue("Filters:Current.TagName")" value="@i.GetValue("Ecom:Filters.ProductFields.Row.Value")" type="checkbox" @i.GetValue("Ecom:Filters.ProductFields.Row.CheckedState")> @i.GetValue("Ecom:Filters.ProductFields.Row.Text")
      </label>
    }
  </div>
</fieldset>

 

Ricardo Pereira


Replies

 
Mikkel Ricky
Reply
This post has been marked as an answer

Take a look at this forum thread: http://developer.dynamicweb-cms.com/forum/templates/razor-groups-orderby-with-linq.aspx

Best regards,
Mikkel

Votes for this answer: 1

 

You must be logged in to post in the forum