Click here to Skip to main content
15,896,111 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I have a Main.cstml which is a normal view inside which I am rendering 2 partial views.

Code for Main.cshtml


@Html.Partial("Partial1")



@Html.Partial("Partial2")


Code for Partial1.cshtml

@model PartialViewDemo2.Models.Product
@using (Ajax.BeginForm("Partial1", "Home",
new AjaxOptions()))
{
@Html.TextAreaFor(m => m.Name)
<input type="submit" id="SubmitButton" />
}

Similarly there are some controls on Partial2.cshtml

Code on controller
SQL
[HttpPost]
        public ActionResult Partial1(Product product)
        {
            return View(product);
        }


When I click on submit button present on Partial1.cshtml, I want both the views to render, but only Partial1 gets rendered and Partial2 goes off.
I have represented my problem here using a very simple demo. Kindly help.
Posted
Updated 29-Oct-13 2:23am
v2

1 solution

Your AJAX code is using the stuff generated by MVC. You have two forms on your page. They both update themselves using AJAX. They are discrete. Your best bet is probably to make the successful return from one form, fire the other one, it's a separate AJAX call to get a separate block of data inside a separate form. An alternative is to write your own AJAX code in jquery, then you have full control and can update anything on the page that you like.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900