Press Ctrl / CMD + C to copy this to your clipboard.
This post will be reported to the moderators as potential spam to be looked at
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
What kind of errors are you having when you use GroupBy? Can you post some of your code as well?
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,
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.
@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
is working on a reply...
Write your reply to:
Upload image
Image will be uploaded when post is submitted
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
What kind of errors are you having when you use GroupBy? Can you post some of your code as well?
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");
Thanks you so much for helping.
regards,
kusum
Try this:
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.
@inherits Umbraco.Web.Macros.PartialViewMacroPage @using System.Linq @{ var groupedItems = CurrentPage.Descendants("Evenement").GroupBy(x => x.GetPropertyValue("dateDeLevenement"));
}
still getting Error loading Partial View script
is working on a reply...