MVC - Trigger submit event of partial view in main view using JQuery


I am using Ajax.BeginForm in my partial view to submit the data.

Partial view - _getCategoryMaster.cs

<div> @using (Ajax.BeginForm("Submit", "CategoryMasterDataEntry", new AjaxOptions { OnSuccess = "OnDatatSuccess", OnFailure = "OnDataFailure", HttpMethod = "POST" }, new { enctype = "multipart/form-data" })) { <div style="float:left;width:100%;"> <hr class="horizontal-line-bottom" /> <div class="form-buttons tab-footer"> <button class="btn btn-md" type="submit" id="saveData" @if (TempData["DisplayAccess"].ToString() == "view") { <text> disabled </text> }>SAVE</button> </div> </div> } </div>

Now i'm trying to call this submit event from my parent view on the click event of the link from Jquery

Parent View -

<html> <head> <script type="text/javascript"> $(document).on('click', '.getProducts', function (e) { alert("Start"); $('form#ajaxForm').trigger('submit'); alert("End"); </script> </head> <body> <a id="anchId" href="javascript:void(0);" class="getProducts"> <img src="~/Images/bullets.png" class="bullet-image" /> <span class="menu-text">LinkName</span> </a> </body> </html>

But its not firing that submit event of the partial view. I am getting those alerts (start and End). But its not firing that submit event.

What am I doing wrong here?


You do not have a form with id="ajaxForm". Replace new { enctype = "multipart/form-data" } (which is pointless since you cannot submit files using Ajax.BeginForm()) with new { id= "ajaxForm" }

@using (Ajax.BeginForm("Submit", "...", new AjaxOptions { ... }, new { id = "ajaxForm" }))

or simply use $('form').trigger('submit');


  • New BFC “clearing” floating boxes
  • Howto take a glimpse into mscorlib?
  • PHP - sending email with attachment does not show message content
  • doPostBack from C# with JavaScript
  • Multibinding Multiselection ListView
  • passing a javascript variable to PHP with xmlhttprequest
  • What is the likely cause of a net::ERR_CONNECTION_ABORTED when uploading a file to Spring
  • my tic-tac-toe program in matlab does not work [closed]
  • Enumerating Controls on a Form
  • Form tag not showing up in haml file
  • Lock Horizontal View
  • order post according to custom array position
  • How to handle images sent by a mobile device?
  • preg_replace Double Spaces to tab (\\t) at the beginning of a line
  • How do I alternate colors in Flat List (React Native)
  • Listbox within Listbox and scrolling trouble in Windows Phone 7 Silverlight
  • Disable Enter in editText android
  • OpenGL ES texture problem, 4 duplicate columns and horizontal lines (Android)
  • Avoid links criss cross / overlap in d3.js using force layout
  • Using $this when not in object context
  • What is the “return” in scheme?
  • How do I fake an specific browser client when using Java's Net library?
  • How reduce the height of an mschart by breaking up the y-axis
  • How to check if every primary key value is being referenced as foreign key in another table
  • Perl system calls when running as another user using sudo
  • How to show dropdown in excel using jrxml (jasper api)?
  • jquery mobile loadPage not working
  • jQuery tmpl and DataLink beta
  • Unanticipated behavior
  • SQL merge duplicate rows and join values that are different
  • Proper way to use connect-multiparty with express.js?
  • NSLayoutConstraint that would pin a view to the bottom edge of a superview
  • python regex in pyparsing
  • How to set the response of a form post action to a iframe source?
  • How get height of the a view with gone visibility and height defined as wrap_content in xml?
  • Java static initializers and reflection
  • python draw pie shapes with colour filled
  • unknown Exception android
  • Observable and ngFor in Angular 2
  • Unable to use reactive element in my shiny app