Copied to clipboard

Flag this post as spam?

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


  • k 256 posts 654 karma points
    Aug 26, 2015 @ 05:32
    k
    0

    Using Groupby()

    Hello ,

    I need to groupBy date , but I am getting errors when I am using GroupBy().

    Can someone please help me out on the above.

    I am using umbraco 7.

    Thanks in advance,

    kusum

  • Mark Bowser 273 posts 860 karma points c-trib
    Aug 26, 2015 @ 21:01
    Mark Bowser
    0

    What kind of errors are you having when you use GroupBy? Can you post some of your code as well?

  • k 256 posts 654 karma points
    Aug 31, 2015 @ 11:17
    k
    0

    Hello ,

    I found the code on : https://our.umbraco.org/forum/developers/razor/47243-Using-GroupBy-to-sort-a-list-by-year-and-month

    I am trying to implement it as below , but getting error (Error loading Partial View script ).

    var groupedItems = CurrentPage.Descendants("Evenement").GroupBy("dateDeLevenement");

        foreach(var item in groupedItems .Elements)
        {
            <h3>@item .Name</h3>
    
    }
    

    Thanks you so much for helping.

    regards,

    kusum

  • David Verberckmoes 46 posts 77 karma points
    Aug 31, 2015 @ 12:44
    David Verberckmoes
    0

    Try this:

    var groupedItems = CurrentPage.Descendants("Evenement").GroupBy(x => x.GetPropertyValue("dateDeLevenement"))
    

    Note that you will be grouping on the full date and time, in order to group by date only you can add a .Date before the last bracket.

  • k 256 posts 654 karma points
    Sep 01, 2015 @ 04:53
    k
    0

    @inherits Umbraco.Web.Macros.PartialViewMacroPage @using System.Linq @{ var groupedItems = CurrentPage.Descendants("Evenement").GroupBy(x => x.GetPropertyValue("dateDeLevenement"));

        foreach(var item in groupedItems)
        {
            <h3>@item.Name</h3>
    
    }
    

    }

    still getting Error loading Partial View script

Please Sign in or register to post replies

Write your reply to:

Draft