0

I have three Partial Views on my main form in which i have defined Submit buttons, i.e each partial view has its own submit button and i am using HTML.BeginForm() for taking the updated value from the partial view.Now on click of Submit button on the main form, i have called jquery function -

$("#btnUpdate").click(function () {

$("#Update1").click(); // update1 is the submit button in partial view.
//other saving code is already here
}

Above function works properly, now i want to fire click events of two more partial view but the problem is that it takes only one click event.i want to do something like that -

$("#btnUpdate").click(function () {
$("#Update1").click();
$("#Update2").click();
$("#Update3").click();

}

Is it possible to do so ? or is there any alternate method for taking the updated value from all these partial view on click of submit button.Any help would be appreciated.

sheetu
  • 11
  • 2
  • Why don't you use ajax methods to post individuals? – Bharat Jul 23 '21 at 07:02
  • @Bharat, thanks for your comment, but i need updated value from the partial view so i can save that in my database and in my save function i passed the model as i am using HTML.BeginForm() post method, my function looks like - public IActionResult SaveCustomerPricing(PricingModel pricing){}. IS it possible to get pricing model with updated value in ajax, so i can pass it in ajax method as data ? – sheetu Jul 23 '21 at 08:12
  • You can submit the form via AJAX. https://stackoverflow.com/questions/1960240/jquery-ajax-submit-form – Chetan Jul 23 '21 at 08:36
  • @Chetan,i want model for passing it as a data,Is it possible to get model with updated value in ajax, so i can pass it in ajax method as data ? – sheetu Jul 23 '21 at 10:02
  • If you have individual forms in partial views and they are bound to a model then you should just submit those forms via AJAX. – Chetan Jul 23 '21 at 10:32
  • How are you planning to get the model data? it will be useful if you share the relevant code which involved partial views, their controller actions, and the model classes and respective java script code.. – Chetan Jul 23 '21 at 10:33
  • @Chetan thanks, problem resolved by this - stackoverflow.com/questions/1960240/jquery-ajax-submit-form – sheetu Jul 23 '21 at 11:05

0 Answers0