PartialView’s submit function runs when the Parent form is submitted.

A partialView is having it’s Post function called when I submit the containing form. This was resolved by changing the name of the PartialView’s post function.

Originally in the partialView’s controller I had:

[ChildActionOnly]
public ActionResult EditPartial(FileLocationViewModel vm)
{
...
return PartialView(vm);
}

[HttpPost]
[ValidateAntiForgeryToken]
public ActionResult EditPartial(FileLocationViewModel vm, FormCollection fc)
{
...
}

Changed the Post function signature as follows to resolve the issue:

[ChildActionOnly]
public ActionResult EditPartial(FileLocationViewModel vm)
{
...
}

[HttpPost]
[ValidateAntiForgeryToken]
public ActionResult EditPartialSubmit(FileLocationViewModel vm, FormCollection fc)
{
...
}

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

w

Connecting to %s