How can I switch view of "new" and "old" pages (in MVC)


I have a CalendarPage that contains CalendarEventPage's (with Start and End time, ++). The normal view when you enter the CalendarPage is a table with some information about all the CalendarEventPages that has not yet ended.

I have an Index method in the CalendarPageController that retrieves all the CalendarEventPages that has not yet ended.

But I also want to have a link on the list page that will retrieve all the CalendarEventPage's that has allready ended (a history link).

How can I accomplish that if I want to avoid sending parameters in the URL?

Nov 01, 2013 13:13

Depends on the amount of events that you need to show. You can for instance render all the events using HTML (in two tables) and then use CSS and JavaScript to show/hide the past events. Another option is to use an ajax request to get the past events and then in your controller use Request,IsAjaxRequest() to determine if this is a normal request or ajax request, if it's an ajax request you know it's for the past events and you can return a partial viiew instead with just the results you need and then inject it into your markup.


Nov 01, 2013 16:06

Thanks Frederik!

Nov 04, 2013 8:21
This thread is locked and should be used for reference only. Please use the Episerver CMS 7 and earlier versions forum to open new discussions.
* You are NOT allowed to include any hyperlinks in the post because your account hasn't associated to your company. User profile should be updated.