Upcoming events

36 views
Skip to first unread message

Joel Kinzel

unread,
Dec 13, 2012, 3:24:24 PM12/13/12
to reddot-c...@googlegroups.com
I feel like I've asked this question before, but perhaps it was just to Jian a while back.

We have a problem in which customers want only the next N events from today to show up. Obviously we can sort by date, but the problem is that dates in the future show up, instead of dates from today forward. If we sort the opposite way, dates from the past are listed instead. We are currently using pre-execute to add events to a custom "event" class list, and then using the date property of that class to sort and eliminate items from the list. We then loop over the list and print it out accordingly. 

To me that seems like an awful lot of work. Is there something we are missing where we can achieve this functionality without pre-execute or JavaScript?
Message has been deleted

Stu Wilson

unread,
Dec 14, 2012, 11:08:47 AM12/14/12
to reddot-c...@googlegroups.com
Joel

I had to implement something similar last year and you are right, its a bit of a palaver to implement, I had to do it in a control on the page and would pass in the full list of events as an property (XML string).

* read the list of events into sortable structure (I used a .Net List<Event> where Event is my class including a Date)
* implement a date sorter that gets items in the srrtable list greater than today, and limited by number. ( I used a LINQ query as follows)

            var varResults = (
                        from a
                            in Data.Items
                            where a.ItemDate >= m_dateToday
                            orderby a.ItemDate ascending
                            select a
                        ).Take(2); // the number of events to show from this date

a caveat is this the number of results may return 0.

Stu Wilson

Tim D

unread,
Dec 14, 2012, 11:13:32 AM12/14/12
to reddot-c...@googlegroups.com
You can alternatively use Delivery Server Target or Search driven on metadata to produce lists that would require RQL. No customizations that you need to upgrade.
Reply all
Reply to author
Forward
0 new messages