AjaxOption

Introduction

AjaxOption controls flow of Ajax.BeginForm. This article describe about AjaxOption and their properties which controls the flow of Ajax.BeginForm.

Getting Started

This is the object of AjaxOptions class which comes under System.Web.Mvc.Ajax namespace. It represents option settings for running Ajax scripts in an ASP.NET MVC application. Below we will discuss more details about this option specially properties which controls the activity of Ajax.BeginForm.

Property of AjaxOption

  1. Url:

    Gets or sets the URL to make the request to. This property is optional if it is attached to an anchor (a) or form element.

  2. Confirm:

    This property accepts string value and gets or sets the message to display in a confirmation window before a request is submitted.If this property is empty, the user is not prompted. If this property is set, the user is prompted before the OnBegin function is called.

  3. HttpMethod:

    This property accept string value and the value must be "Get" or "Post".The default value of this property is "Post". It tells how request will execute.

  4. InsertionMode:

    it gets or sets the mode that specifies how to insert the response into the target DOM element.It has three modes InsertAfter, InsertBefore, Replace. The default value is Replace.

  5. OnFailure:

    It accepts string value, a JavaScript function to call if the page update fails.This function is called if the response status is not in the 200 range.

  6. OnSuccess

    It accepts string value, a JavaScript function to call after the page is successfully updated. This function is called if the response status is in the 200 range.

  7. UpdateTargetId: It accepts string value the ID of the DOM element to update by using the response from the server.
  8. OnBegin

    This is string datatype property,it accept name of JavaScript function which is called by ASP.NET MVC after the HttpRequest object is instantiated but before it is invoked.

  9. OnComplete

    It is also a string datatype property, like OnBegin property it also accept javascript function name. The specified function is called whether the page update is successful or not. The call to this function occurs before a call to either OnSuccess or OnFailure, to cancel the page update, return false from the JavaScript function.

  10. LoadingElementDuration

    This property is of int type Datatype, it takes int value in millisecond for showing animation, for example showing loading text while processing your application.

  11. LoadingElementId

    This property is of string type datatype, and it takes id of HTML element to display, such as an image or a text-based element that can display a message. The specified element is displayed when the OnBegin function is called. The element is hidden when the OnComplete function is called.

Summary

Here we have discussed all the property of AjaxOption, hope you have got the discussion of this article

Thanks

Kailash Chandra Behera

An IT Professional with 12 years experience in development life cycle in windows, service and Web based application using Microsoft.Net technologies. Proven record of developing all phases of projects in Microsoft.Net technology from initiation to closure aligning with the company's Business objectives to drive process improvements, competitive advantage and bottom-line gains. -> Good exposure of independently working and developing multiple projects ->Committed to efficient and effective development of projects in a fast-paced and deadline driver environment. Skill :- Develop and design projects in various technologies of Microsoft Technology. Total IT Experience- 13+

Previous Post Next Post

نموذج الاتصال