Copied to clipboard

Flag this post as spam?

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

  • Martijn 1 post 71 karma points
    7 days ago

    GetPagedChildren how to orderby and filter

    Hi there,

    I used this method to create a custom controller that I can access thru xhr. (first of all is this still usable / preferable in V8?)

    My custom method looks like this and is working. Now I am stuck with the ordering and filtering.

        [System.Web.Http.AcceptVerbs("GET", "POST")]
        public ActionResult GetNewsByParentId(int Id,int PageIndex = 0,int PageSize = 10
        , string orderby, string direction, string filter = null)
            //are there children for this content id?
            bool hasChildren = Services.ContentService.HasChildren(Id);
            //get the first 10 childeren
            IEnumerable<IContent> Children = Services.ContentService.GetPagedChildren(Id, PageIndex, PageSize, out long TotalChildren);
            //create Json object
            var result = new JsonResult
                Data = new
                JsonRequestBehavior = JsonRequestBehavior.AllowGet
            return result;

    Ordering: I would like to now if I can filter by a 1 or multiple custom field .OrderBy("Tag").ThenBy("Date")

    Or can i only use the default properties (publisheddate, Name etc) (and where can I find a list with witch ones)

    The ordering direction? Is there a example how this works (what do I need to fill in).

    De filter function How can I use to search on multiple tags / words / numbers (is this even possible?) can i use where and or contains?

    I hope somebody can help me with a nice example.

    Services.ContentService.GetPagedChildren(Id, PageIndex, PageSize, out long TotalChildren,"?","?","?");


Please Sign in or register to post replies

Write your reply to: