Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • Damon 217 posts 287 karma points
    Jul 23, 2015 @ 14:34
    Damon
    0

    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!

  • Jason 113 posts 628 karma points
    Jul 23, 2015 @ 14:58
    Jason
    0

    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:

    /umbraco/surface/{controllername}/{action}/{id}
    
  • Mark 255 posts 612 karma points
    Jul 23, 2015 @ 15:26
    Mark
    0

    If not surface controllers, you might want to hijack the route. Check this out:

    https://our.umbraco.org/documentation/Reference/Templating/Mvc/custom-controllers

  • This forum is in read-only mode while we transition to the new forum.

    You can continue this topic on the new forum by tapping the "Continue discussion" link below.

Please Sign in or register to post replies