Copied to clipboard

Flag this post as spam?

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


  • umbracocool 108 posts 197 karma points
    Jul 10, 2013 @ 09:04
    umbracocool
    0

    Distinct Values in Razor

    Hey Guys. I would do this but do not know how.

    I get the query:

    2010
    2007
    2006
    2007
    2007
    2007
    2010
    2009
    2006


    I would get

    2010
    2009
    2007
    2006

     

    Is it possible?

    foreach (var item in Model.NodeById(1205).Children.GroupBy("Name")){
       @item.Name <br />
    }

    It does not work!. I use Umbraco 4.11.5 

    Thank you!

  • Fuji Kusaka 2203 posts 4220 karma points
    Jul 10, 2013 @ 09:13
    Fuji Kusaka
    0

    Not sure what you are trying to do here !!

  • Jeroen Breuer 4909 posts 12266 karma points MVP 5x admin c-trib
    Jul 10, 2013 @ 09:17
  • umbracocool 108 posts 197 karma points
    Jul 10, 2013 @ 09:47
    umbracocool
    0

    Thank you Jeroen Breuer!. What is accu bottlenose porpones the DTOs and then do not repeat each other?

     

    I tried this:

     

    @ {

    var mylist = new List ();

    if (! mylist.Select (x => x.Id). Contains (1))

    {

    mylist.Add (new DynamicNode(1));

    }

    @mylist.ToList();

     

    And I get this:

     

    "Error CS0305: Using the generic type 'System.Collections.Generic.List' REQUIRES 1 type arguments".

     

    Because that Razor will get a list of different data becomes complicated?. Grrr hehe.

  • Scott 95 posts 277 karma points
    Jan 29, 2015 @ 12:55
  • 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