Copied to clipboard

Flag this post as spam?

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


  • Damien (Slipoch) 62 posts 346 karma points
    Jan 31, 2017 @ 03:34
    Damien (Slipoch)
    0

    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.

  • Biagio Paruolo 1594 posts 1825 karma points c-trib
    Jan 31, 2017 @ 21:41
  • Damien (Slipoch) 62 posts 346 karma points
    Feb 01, 2017 @ 23:36
    Damien (Slipoch)
    0

    Do you know of a way to put the node selection to a MVC controller instead of html?

  • Biagio Paruolo 1594 posts 1825 karma points c-trib
    Feb 02, 2017 @ 06:04
    Biagio Paruolo
    0

    In the controller you need to use contentservice api.

  • Damien (Slipoch) 62 posts 346 karma points
    Feb 02, 2017 @ 06:37
    Damien (Slipoch)
    0

    That will work with treenodes?

  • Biagio Paruolo 1594 posts 1825 karma points c-trib
    Feb 02, 2017 @ 08:59
    Biagio Paruolo
    0

    You need to use SectionService too.

  • Damien (Slipoch) 62 posts 346 karma points
    Feb 02, 2017 @ 22:48
    Damien (Slipoch)
    0

    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.

  • Damien (Slipoch) 62 posts 346 karma points
    Jan 31, 2017 @ 22:37
    Damien (Slipoch)
    0

    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.

  • Biagio Paruolo 1594 posts 1825 karma points c-trib
    Feb 02, 2017 @ 06:05
    Biagio Paruolo
    0

    Do you create a new back office section?

  • Damien (Slipoch) 62 posts 346 karma points
    Feb 02, 2017 @ 06:34
    Damien (Slipoch)
    0

    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.

  • Biagio Paruolo 1594 posts 1825 karma points c-trib
    Feb 02, 2017 @ 08:56
  • Damien (Slipoch) 62 posts 346 karma points
    Feb 02, 2017 @ 22:49
    Damien (Slipoch)
    0

    None of these examples allow a redirect to a cshtml page or a controller that calls said page.

  • David Brendel 792 posts 2970 karma points MVP 3x c-trib
    Feb 03, 2017 @ 07:27
    David Brendel
    0

    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

  • Biagio Paruolo 1594 posts 1825 karma points c-trib
    Feb 03, 2017 @ 08:25
    Biagio Paruolo
    100

    Damien you need to write a web api method and so to use Angular JS to present data into the back office area.

  • Damien (Slipoch) 62 posts 346 karma points
    Feb 06, 2017 @ 03:22
    Damien (Slipoch)
    0

    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

  • Biagio Paruolo 1594 posts 1825 karma points c-trib
    Feb 06, 2017 @ 07:10
    Biagio Paruolo
    0

    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.

Please Sign in or register to post replies

Write your reply to:

Draft