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 ?
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.
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.
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
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
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
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
is working on a reply...