I am trying to figure out how to get a simple Contact Form SurfaceController working. The problem is that when I try to navigate to the Contact Us page, I get a "No route in the route table matches the supplied values." error.
My surface controller:
namespace UmbracoSurface2.Controllers
{
public class ContactFormSurfaceController : SurfaceController
{
public ActionResult Index()
{
return PartialView("ContactForm", new ContactFormViewModel());
}
}
}
The one big difference between mine and the screencasts and examples I've found is that I'm using Visual Studio 2013 so the ASP.NET Website template has a newer version of MVC which I had to remove to get the UmbracoCms NuGet package to install. I also tried it without adding MVC to the project at the beginning.
How to fix No route error when using SurfaceController in Umbraco 7.1.8?
I am trying to figure out how to get a simple Contact Form SurfaceController working. The problem is that when I try to navigate to the Contact Us page, I get a "No route in the route table matches the supplied values." error.
My surface controller:
My ContactForm partial:
and my template:
The one big difference between mine and the screencasts and examples I've found is that I'm using Visual Studio 2013 so the ASP.NET Website template has a newer version of MVC which I had to remove to get the UmbracoCms NuGet package to install. I also tried it without adding MVC to the project at the beginning.
Any help/suggestions would be appreciated,
hi webico,
Can you remove this line from your template :
That way we can determine if it's related to the surface controller or another problem.
Dave
Hi Webico
I think your Surface Controller is called ContactFormSurfaceController
and the convention is to remove the word 'Controller' from the name and so to render as an action you would use:
otherwise you are saying look for a route on a ContactFormControllerController which doesn't exist hence the route missing error...
If you want to handle the postback of the form the trick is to have the form elements wrapped in an Html.BeginUmbracoForm
then have an action called HandlePost in your surface controller decorated with post:
is working on a reply...