Sep 14, 2015

What is difference between html.beginform and ajax.beginform?

Html.BeginForm() will create a form on the page that submits its values to the server as a synchronous HTTP request, refreshing the entire page in the process.

 Ajax.BeginForm()
 creates a form that submits its values using an asynchronous ajax request. This allows a portion of the page to be update without requiring that the entire page be refreshed. 

"BeginForm()" 

is an extension method that writes an opening "<form>" tag to the response. 

"BeginForm()" is an extension method for both HtmlHelper and AjaxHelper classes. It returns an MVCForm object from both HtmlHelper and AjaxHelper class instances so there is not much difference but the AjaxHelper method submits the form asynchronously using JavaScript.

There are two types of the BeginForm() extension methods, they are:

  • Html.BeginForm()
  • Ajax.BeginForm()


No comments:

Post a Comment