Copied to clipboard

Flag this post as spam?

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


  • Dibs 202 posts 991 karma points
    Sep 18, 2019 @ 09:33
    Dibs
    1

    SurfaceController v RenderMvcController Custom Controllers

    Dear Umbraco Team

    I can create a form using a SurfaceController and follow Model, Controller and View as expected. I can add the partial view of the form into any template i have created in Umbraco. No dedicated doc types required to be created in Umbraco.

    Attempting to create RenderMvcController while following Model, Controller and View, i am unable to render my view in a template. I get error message

    No route in the route table matches the supplied values.

    Our umbraco documentation requires a doc type to be used for creating a custom RenderMvcController, Follwoing the documentation by making use of a doc type works, but i would like to just plug my custom RenderMvcController into a template as a partial view like SurfaceController.

    How do you create a custom RenderMvcController and plug the partial view into any template ?

    Thanks Dabinder

  • Shaishav Karnani from digitallymedia.com 354 posts 1638 karma points
    Sep 18, 2019 @ 11:22
    Shaishav Karnani from digitallymedia.com
    100

    Hi Dabinder,

    This is good article on Custom Controller or Hijacking Umbraco Routes.

    https://our.umbraco.com/documentation/reference/routing/custom-controllers.

    For RenderMvcController, to work you will need a Doc Type as by default all of the front end routing is executed via the Umbraco.Web.Mvc.RenderMvcController

    But you can extend the RenderMvcController and customise the behaviour and then pass it to view.

    Please share your code if you need any further assistance.

    Cheers,

    Shaishav

  • Dibs 202 posts 991 karma points
    Sep 19, 2019 @ 05:52
    Dibs
    1

    Thanks Shaishav

    I have followed that article, it states to use a doc type and create the controller with the same name. I would like to use RenderMvcController as a partial view and make use of

    @html.Action("Index", "CustomController")

    in any template.

    I dont want to make use of a doc type and associated template to render external api content.

    thanks Dabinder

Please Sign in or register to post replies

Write your reply to:

Draft