Copied to clipboard

Flag this post as spam?

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


  • Akeem 43 posts 198 karma points
    Apr 20, 2016 @ 20:54
    Akeem
    0

    SORT UMBRACO.CONTENT ITEMS

    Hi ,

    please can someone help me with this . All am trying to do is Sort the eventDetail by the Date . So the eventDetails is coming from this GRID .

    enter image description here

    How i retrieve the Events, From my view

    { var eventdetail = Umbraco.Content(0); eventdetail = SmartBlog.Event.GetEvents(eventdetail); }

    GetEvents comes from my controller :

       public static dynamic GetEvents(dynamic eventdetail)
        {
    
    
            if (System.Threading.Thread.CurrentThread.CurrentCulture.ToString() == "en-CA")
            {
                eventdetail = GetUmbracoHelper().Content(1121).eventDetails;
            }
            else if (System.Threading.Thread.CurrentThread.CurrentCulture.ToString() == "fr-CA")
            {
                eventdetail = GetUmbracoHelper().Content(1963).eventDetails; //1963
            }
            else
            {
                eventdetail = GetUmbracoHelper().Content(2037).eventDetails;
            }
          //  eventdetail = eventdetail.sort();
            return eventdetail;
        }
    }
    

    it does returns an Array of key/value pair . i would say JSON . but when i checked the type while debugging, it say ARRAY , upto 5 indexes . Please how can i SORT this .. before i do my for each . Please help

       @foreach (var item in eventdetail)
            {
                <tr class="eventmonth">
                    <th colspan="3">
                        @{ 
                            var months = Convert.ToDateTime(item.day).ToString("MMM");
                         var year = Convert.ToDateTime(item.day).ToString("yyyy");
                      var dd =   Convert.ToDateTime(item.day).ToString("dd");
                        }
                        <h2 class="month" monthValue="@Html.Raw(Convert.ToDateTime(item.day).ToString("MM"))">
    
                            @Html.Raw(months +" "+ year) 
                        </h2>
                    </th>
                </tr>
    
Please Sign in or register to post replies

Write your reply to:

Draft