ASP.NET MVC Ajax helpers

Helper method Description
Ajax.ActionLink

Creates a hyperlink to a controller action that fires an Ajax request when clicked

Ajax.RouteLink

Similar to Ajax.ActionLink, but generates a link to a particular route instead of a named controller action

Ajax.BeginForm

Creates a form element that submits its data to a particular controller action using Ajax

Ajax.BeginRouteForm

Similar to Ajax.BeginForm, but creates a form that submits its data to a particular route instead of a named controller
action

Ajax.GlobalizationScript

Creates an HTML script element that references a script that
contains culture information

Ajax.JavaScriptStringEncode

Encodes a string to make sure that it can safely be used inside JavaScript

 

The relationship between ASP.NET MVC Ajax helpers and JavaScript libraries

The relationship

 

Properties of the AjaxOptions class

Option Description
HttpMethod

Specifies the HTTP method, which can be GET or POST. If not specified, this defaults to POST for forms and GET for links

UpdateTargetId

Specifies the element into which the resulting markup should be inserted

InsertionMode

Sets the insertion mode, which can be InsertBefore (insert the content before the target element’s existing children), InsertAfter (insert the content after the element’s existing children), or Replace (replaces the element’s inner content completely)

OnBegin Specifies a JavaScript function to be called before invoking the action
OnComplete

Specifies a JavaScript function to be called after the response comes back

OnFailure Specifies a JavaScript function to be called in the event of an error
OnSuccess Specifies a JavaScript function to be called if no errors occur
Confirm

Sets the confirmation message to be displayed in an OK/Cancel dialog box before proceeding

Url

Specifies the URL to use if the anchor tag has a different destination than the Ajax request

LoadingElementId

Specifies an element that displays Ajax progress. The element should be marked as display:none initially

LoadingElementDuration

Specifies how long the animation to show/hide the Loading - ElementId should last if the LoadingElementId has been specified

posted @ 2012-09-07 18:35  HelloWorld.Michael  阅读(434)  评论(0)    收藏  举报