Our site editors can include a macro inside the RTE to include a form to participate in a competition or register for an event.
This macro inherits from PartialViewMacroPage and inside the partial an child action is rendered. This child action contains a form and after posting to a SurfaceController I return to CurrentUmbracoPage() when ModelState is invalid. I also add a message to the ViewBag.
But both ModelState and ViewBag are lost as soon as I return to the PartialViewMacroPage.
I tried this solution but the ParentActionViewContext is null inside the PartialViewMacroPage.
I have a working solution using session variables and merging ModelState but I'm hoping someone has a more clean solution.
ModelState and ViewData inside macro
Our site editors can include a macro inside the RTE to include a form to participate in a competition or register for an event.
This macro inherits from
PartialViewMacroPage
and inside the partial an child action is rendered. This child action contains a form and after posting to a SurfaceController I return toCurrentUmbracoPage()
when ModelState is invalid. I also add a message to the ViewBag.But both ModelState and ViewBag are lost as soon as I return to the PartialViewMacroPage.
I tried this solution but the
ParentActionViewContext
is null inside the PartialViewMacroPage.I have a working solution using session variables and merging ModelState but I'm hoping someone has a more clean solution.
is working on a reply...