Hi everybody. I'm having some trouble creating a v4.10 plugin. When I try to add SurfaceController attribute to my class, I got the following error: 'Umbraco.Web.Mvc.SurfaceController' is not an attribute class.
Here's my code:
[SurfaceController("Management")] public class Prova1Controller : SurfaceController { [ChildActionOnly] public ActionResult Index() {
Yes, sorry, it was my error. Of course the classname is Prova1SurfaceController. It seems like I'm not having the SurfaceController attribute class in my umbraco.web.mvc namespace...
I got this error: " No route in the route table matches the supplied values". But if I call the action giving "ProvaSurface" as the controller name it works...
4.10 SurfaceController attribute
Hi everybody. I'm having some trouble creating a v4.10 plugin. When I try to add SurfaceController attribute to my class, I got the following error: 'Umbraco.Web.Mvc.SurfaceController' is not an attribute class.
Here's my code:
[SurfaceController("Management")]
public class Prova1Controller : SurfaceController
{
[ChildActionOnly]
public ActionResult Index()
{
return Content("Ciao");
}
}
thanks in advance for any help
Ok, just a shot in the dark as your error msg is totally unrelated.... From the docs:
To create a locally declared SurfaceController:
Umbraco.Web.Mvc.SurfaceController
So, your class should be Prova1SurfaceController
If still the same error msg, I'd log this issue so a core team member can have a look at it.
Cheers,
/Dir
Yes, sorry, it was my error. Of course the classname is Prova1SurfaceController. It seems like I'm not having the SurfaceController attribute class in my umbraco.web.mvc namespace...
Mmmmh. There's something very strange here.
I'm calling the controller without the class attribute (as a normal SurfaceController).
When, within a View, I want to call an action like this:
@inherits Umbraco.Web.Mvc.UmbracoTemplatePage
@using System.Web.Mvc.Html
@{
Layout = null;
}
Action: @Html.Action("index", "Prova")
I got this error: " No route in the route table matches the supplied values". But if I call the action giving "ProvaSurface" as the controller name it works...
Marcos
Have you tried using an ActionLink HTML helper?
@Html.ActionLink("Link Text", "Action Name", "Controller Name")
So in your case:
@Html.ActionLink("Click Here", "Index", "Prova1")
Having just tried that myself, I think this should work:
@Html.ActionLink("Click Here", "Index", "Prova1Surface")
Yes, it works. But I thought that I should refer the controller as just "Prova" and not "ProvaSurface".
Anyway, I still got the ClassAttribute problem, so i cannot make area-separated controllers
I thought so too but my controller didn't work until I added the full name, leaving off "controller"
Not sure about the other issue because I'm not getting it - mine is a fresh install of 4.11; are you on 4.10?
I'd definitely log the issue, but you might also try the exact same thing in a 4.11 site and see if you can narrow it down?
Hi
Seems we should use the PluginController attribute instead
[PluginController("MyArea")]
http://issues.umbraco.org/issue/U4-702
is working on a reply...