This is the updated version of the Nikhil’s excellent example on how to use Ajax with ASP.net MVC.
I commented all the changes made in the code and prefixed them with //emad. So just search for //emad and you will see all the changes I made… Here is a quick list of the changes I made to make this compile and run on MVC Preview 2:
- Removed the [ControllerAction] tags – they are no longer needed.
- Updated the Route Table creation in the global.asax.cs file to work with the new format
- Updated the Ajax framework project to use the new classes
- HttpContextBase instead of IHttpContext
- HttpRequestBased instead of IHttpRequest
- HttpResponseBase instead of IHttpResponse
- Updated the AjaxViewContext constructor to match ViewContext constructor
- Changed the web.config to work with the new version (copied and pasted from another preview 2 project)
Note: Test project was not updated and will not compile – sorry, I didn’t have time to do it.
Here is the updated code: tasklist.zip