Copied to clipboard

Flag this post as spam?

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


  • sony 11 posts 111 karma points notactivated
    Feb 07, 2016 @ 14:45
    sony
    0

    How to show Node Names with same order as it is in Umbraco backoffice using Examine Search?

    Hello Support,

    In umbaco backend the Nodes Order is:

    ItemsA

    item1

    item2

    item3

    ItemsB

    item4

    item5

    imte6

    I am using this code :

    @if (!string.IsNullOrEmpty(Request.QueryString["q"])) {

    }

    this code is not working properly.

    Output should be out same as Umbraco backend:

    ItemsA

    item1

    item2

    item3

    ItemsB

    item4

    item5

    imte6

    Thanks.

  • Anders Bjerner 487 posts 2989 karma points MVP 7x admin c-trib
    Feb 07, 2016 @ 22:20
    Anders Bjerner
    0

    Try something along this way:

    @foreach (var result in Umbraco.TypedSearch(Request.QueryString["q"]).OrderBy(x => x.SortOrder)) {
        <p>@result.Name (@result.SortOrder)</p>
    }
    

    It of course only works if the results are in the same folder.

  • sony 11 posts 111 karma points notactivated
    Feb 08, 2016 @ 06:00
    sony
    0

    Thanks for reply Anders.

    I have used this but it works for same parent folder.

    But in this case result is coming from multiple folders and sort order not working there.

    It should be look like this :

    1. ItemsA

       item1
      
      
       item2
      
      
       item3
      
    2. ItemsB

      item4
      
      
      item5
      
      
      imte6
      

    ItemsA and ItemsB are parent folders.

    thanks.

  • Ismail Mayat 4511 posts 10090 karma points MVP 2x admin c-trib
    Feb 08, 2016 @ 08:48
    Ismail Mayat
    0

    Sony,

    You will have to group them first using by parent then do Anders suggestion of sort.

    Regards

    Ismail

Please Sign in or register to post replies

Write your reply to:

Draft