List/detail views with MVC 3 and AJAX
24 January 2011
List / detail views with MVC 3 and AJAX
In my quest to master Razor I tried to get a list/detail view up and running spiced up with a dash of AJAX and it turned out to be surprisingly easy – the code needed is available below. I used the OmniCorp demo site for this spike and the code is using the ‘News’ data type from that site – if you want to duplicate this behavior you should update the name space references to ‘Omnicorp.Content’ and the ‘News’ type and it’s fields. Here are the steps needed to replicate this sample:
- Set up a OmniCorp demo site and install the MvcPlayer – this process is described in a previous blog post.
- Copy in the controller class below (to your ~/App_Code folder)
- Create the folder ~/Views/News and copy in the two views shown below.
- Add an instance of the MvcPlayer function to a page and specify "/News" as path – save, publish and browse to your test page to try it out.
The controller
Presentation no longer availableThe views
Presentation no longer availablePresentation no longer available
comments powered by Disqus