Copied to clipboard

Flag this post as spam?

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


  • MC 19 posts 89 karma points
    Mar 20, 2014 @ 18:33
    MC
    0

    macro razor script How to order by Alphabetical

    Hello ,

     I am trying to get order by  alphabetical  only the orderby desc is working but when i try order by alphabatical it doesn't work. Is there any where that i can get sort order by aplabetical? I am using razor macro script here is my code  var nodes = Model.Children.OrderBy("Name asc");

     

    Thank you .

    MC

  • Dennis Aaen 4500 posts 18255 karma points admin hq c-trib
    Mar 20, 2014 @ 19:08
    Dennis Aaen
    0

    Hi MC,

    Did you try just to order by name and see if it give the result that you are after. The default sort order as I remember is asc, so try this:

    var nodes = Model.Children.OrderBy("Name");

    Hope it heps,

    /Dennis

     

     

  • MC 19 posts 89 karma points
    Mar 22, 2014 @ 06:28
    MC
    0

    Hi Dannis ,

    Thank you for quick reply. its work very well. I have another question can i order by mulitple like order by Type then by name 

    or can i do something like goup by Type order by name something like this ?

    MC.

  • Dennis Aaen 4500 posts 18255 karma points admin hq c-trib
    Mar 22, 2014 @ 11:22
    Dennis Aaen
    100

    Hi MC,

    Yep, you can do more complex ordering by multiple properties, with descending and ascending support: It will look like this in shorthand syntax;

    var nodes = Model.Children.OrderBy("type,name");

    If it doesn't work you could try this syntax:

    var nodes = Model.Children.OrderBy("type").OrderBy("name");

    /Dennis

  • MC 19 posts 89 karma points
    Mar 25, 2014 @ 14:26
    MC
    0

    Thank you Denis  I am appreciated your help. 

    MC.

Please Sign in or register to post replies

Write your reply to:

Draft