public class FormSurfaceController : Umbraco.Web.Mvc.SurfaceController
{
[HttpPost]
public ActionResult SendEmail(FormViewModel model)
{
//model not valid, do not save, but return current umbraco page
if (!ModelState.IsValid)
{
//Perhaps you might want to add a custom message to the ViewBag
//which will be available on the View when it renders (since we're not
//redirecting)
try
{
ViewData["ErrorMessage"] = "Form Error";
}
catch
{ }
return CurrentUmbracoPage();
}
ViewData["ErrorMessage"] is null when I return to CurrentUmbracoPage.
Could this be because of my
ViewData not persisting from Controller to View Umbraco 6.1.6 MVC
Hi I have a problem where my view data is not persisted. I've read the other threads but I think my problem might be a bit different.
Firstly I have a template page that renders the child nodes umbraco.library.RenderTemplate
This in turn calls my form template which call my partial view with a form
And My Surface Controller
ViewData["ErrorMessage"] is null when I return to CurrentUmbracoPage. Could this be because of my
in my temlate ?
Could be. Could you not just call your partial directly with @Html.Partial? I'm missing why you need to go via the RenderTemplate method.
Andy
is working on a reply...