Step by Step Section creation using mvc controller
Could someone please post or link to a step by step tutorial on creating a section that can use an mvc controller from html pages (not using a tree in the section).
Many of the tutorials out there either miss very large steps, assume you know where the files are going or do not work.
What I want to do:
I want to display a html page in tabs in my section (easy enough), but these html pages need to be able to call functions from a MVC controller and display information from the database (not too hard to implement from a model)
Please be aware, I never used any previous version of umbraco, nor do I know the file structure or particular usings off the back of my hand.
Any tips appreciated, but please explain them properly (no "Now just create a model" if that model does not go in the models folder.)
Hi Biago,
that first link is really useful as it explains several things that none of the others I have found, do.
Definitely worth looking at for anyone doing sections.
It also shows how to create the section without relying on js. (pre-compiled vs runtime compilation is no contest in my book)
But again, we suffer from the assumption of knowledge where it does not specify where some of the files go, ie: when the language xml file is edited is that in the hidden umbraco folder under the project or just the plain config lang folder? and information is left out (like what if you do not want a tree at all?)
Yep, Section is displaying treenodes, I just want to be able to click on a treenode and have it display a cshtml page whihc can use a model I send it from a C# controller.
I kind of hammed my way through some tutes about sections to get the code up and going.
Seems a bit of a waste forcing angular usage when you have precompiled everything else. Especially as you have to create a JS version of the model, thus doubling up on model definitions.
Hi, with web api you have the power that you can use your api in various places of your page and reuse method.
Umbraco as various mvc controller overriding ( surface for the frontoffice, umbracoapi for the backoffice ).
I'm glad that I helped you.
Step by Step Section creation using mvc controller
Could someone please post or link to a step by step tutorial on creating a section that can use an mvc controller from html pages (not using a tree in the section).
Many of the tutorials out there either miss very large steps, assume you know where the files are going or do not work.
I have looked at https://our.umbraco.org/forum/using-umbraco-and-getting-started/78881-is-there-helloworld-plugin-for-umbraco-cms and found it the easiest (and most complete) to follow. The jondjones one is missing swathes of info, Andre Santos one does not function at the end of part II (when it is supposed to), casper's videos are out of date with the current version.
What I want to do: I want to display a html page in tabs in my section (easy enough), but these html pages need to be able to call functions from a MVC controller and display information from the database (not too hard to implement from a model)
Please be aware, I never used any previous version of umbraco, nor do I know the file structure or particular usings off the back of my hand.
Any tips appreciated, but please explain them properly (no "Now just create a model" if that model does not go in the models folder.)
Cheers in advance if anyone bothers to reply.
Hi,
here you can find some docs:
bp
Do you know of a way to put the node selection to a MVC controller instead of html?
In the controller you need to use contentservice api.
That will work with treenodes?
You need to use SectionService too.
Sorry, I must seem dumb as a post, how do I use the above services to redirect to a controller/cshtml view when a treenode is selected?
I have had a look in the services and cannot see anything related to that.
Hi Biago, that first link is really useful as it explains several things that none of the others I have found, do.
Definitely worth looking at for anyone doing sections.
It also shows how to create the section without relying on js. (pre-compiled vs runtime compilation is no contest in my book)
But again, we suffer from the assumption of knowledge where it does not specify where some of the files go, ie: when the language xml file is edited is that in the hidden umbraco folder under the project or just the plain config lang folder? and information is left out (like what if you do not want a tree at all?)
Cheers for the help, any and all are appreciated.
Do you create a new back office section?
Yep, Section is displaying treenodes, I just want to be able to click on a treenode and have it display a cshtml page whihc can use a model I send it from a C# controller.
I kind of hammed my way through some tutes about sections to get the code up and going.
Ah ok. Follow this examples:
None of these examples allow a redirect to a cshtml page or a controller that calls said page.
Hi Damian,
haven't seen an example to use razor views and normal mvc controller for the backoffice. Everythign is html, web api controller and angular js.
Think you have to adopt that to create your custom section
Regards David
Damien you need to write a web api method and so to use Angular JS to present data into the back office area.
Seems a bit of a waste forcing angular usage when you have precompiled everything else. Especially as you have to create a JS version of the model, thus doubling up on model definitions.
If figured as you could create an UmbracoAuthorizedController (https://our.umbraco.org/Documentation/Reference/Routing/Authorized/) for backoffice usage, that there was a way to do it.
Cheers for the help,
Regards, Damien
Hi, with web api you have the power that you can use your api in various places of your page and reuse method. Umbraco as various mvc controller overriding ( surface for the frontoffice, umbracoapi for the backoffice ). I'm glad that I helped you.
is working on a reply...