I have a page that calls another partial view. The page loads fine, but when there is a validation error, it appears to call the post method multiple times.
The code that is causing the issue is here:
<div>
@{Html.RenderAction("ViewUploadedDocs", "TrackingHome", new { number = @Model.Id.ToString() });}
</div>
This should call the following method in the controller.
public ActionResult ViewUploadedDocs(string number)
{
return PartialView();
}
It is not decorated with [HttpGet] or [HttpPost]. The method that keeps getting called is below which is the post method of the page.
[HttpPost]
[MultipleButton(Name = "action", Argument = "Save")]
public ActionResult Edit(EditScreenModelValidation model)
{
if (ModelState.IsValid)
{
return RedirectToAction("UserWorkflows", "Home", new { Area = "Workflow" });
}
return View("Edit", model);
}
I have read on stackoverflow where people have the page calling the post method that they are trying to get, but mine is calling the post method of my main page and not the page that I am trying to get. If I remove the renderAction line in my main page, then the page works correctly, and the action does not call the Edit page in it.