How do you get your own controllers working and returning an ActionResult?
Hi,
I am using Umbraco 7. I have created a partial view with some html. In a Controllers directory in the root of the project I added a controller and action result that returns my partial view. I want to use an Ajax call for this.
But when I browse to it the controller is not hit. What steps do I have to perform to get this controller re working?
Do you have to intercept the Umbraco routing in some way or do something else?
If you inherit from the controller type then you can use the built in Umbraco routing without have to define a custom route, which you could also do. Plus you get easier access to the Umbraco service in the core.
How do you get your own controllers working and returning an ActionResult?
Hi,
I am using Umbraco 7. I have created a partial view with some html. In a Controllers directory in the root of the project I added a controller and action result that returns my partial view. I want to use an Ajax call for this.
But when I browse to it the controller is not hit. What steps do I have to perform to get this controller re working?
Do you have to intercept the Umbraco routing in some way or do something else?
Thanks a lot!
Does your controller inherit form an Umbraco Surface Controller?
https://our.umbraco.org/Documentation/Getting-Started/Code/Forms-Controllers/surface-controllers
If you inherit from the controller type then you can use the built in Umbraco routing without have to define a custom route, which you could also do. Plus you get easier access to the Umbraco service in the core.
Routes for Surface Controller look like this:
If not surface controllers, you might want to hijack the route. Check this out:
https://our.umbraco.org/documentation/Reference/Templating/Mvc/custom-controllers
is working on a reply...