Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • Carlos 338 posts 472 karma points
    Jun 21, 2012 @ 21:07
    Carlos
    0

    How do you use GroupBy in Razor

    There is no real documentation, that I can find anyways, on how to use GroupBy.

    I am getting the Creator Names from multiple nodes. This means that the Creator name shows up multiple times.  How would I group them so the Creator names are grouped together?

     

    Thanks

  • Carlos 338 posts 472 karma points
    Jun 21, 2012 @ 21:30
    Carlos
    0

    Found my answer.

    <ul> 

     

    string parentCurrent "";
          foreach(dynamic node in @Model.NodeById(1089).Descendants("ScienceResearchUpdatesPost").OrderBy("CreatorName"))
          {
            if (parentCurrent != node.CreatorName)
            {
              <li>@node.CreatorName</li>    
            }
            parentCurrent node.CreatorName;
          }
          </ul>

  • Scott 95 posts 277 karma points
    Jan 29, 2015 @ 12:38
  • This forum is in read-only mode while we transition to the new forum.

    You can continue this topic on the new forum by tapping the "Continue discussion" link below.

Please Sign in or register to post replies