The official CTP version of ASP. net mvc framework does not include AJAX support. However, several examples show how to add AJAX for ASP. net mvc applications.
Example:
Public class TaskListController:AjaxController{
Public void Add (string name ){
Task newTask = null;
If (String. IsNullOrEmpty (name) = false ){
NewTask = _ taskDB. AddTask (name );
}
If (IsAjaxRequest ){
If (newTask! = Null ){
RenderPartial ("TaskView", newTask );
}
}Else {
[...]
}
}
}
AjaxaController is a Class I added. It introduces a new attribute IsAjaxRequest. I can use it in the Action method to do something like output different views. It also introduces other members, such as the RenderPartial method, which can generate a part of the user interface by defining the content in a partial view instead of a complete page. The following is my new Controller and the new Add method. In addition to Controller extensions, Nikhil also provides some extension methods for the view to use: "RenderBeginForm is used to generate a common Form label, renderBeginAjaxForm generates an AJAX available Form [...], and the rendform method ". This example shows the first step of using the core AJAX functions of ASP. NET pages-partial refresh, Behaviors, and Extender controls ".
Http://www.infoq.com/news/2007/12/ajax-aspnet-mvc;jsessionid=F7AFF0755D7AE56F7F63196D748BFC1B.