Copied to clipboard

Flag this post as spam?

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


  • Tim Gerhard 6 posts 86 karma points
    Jun 25, 2018 @ 11:17
    Tim Gerhard
    0

    Umbraco Custom Section Controller not found

    Umbraco v.7.11.0 assembly: 1.0.6743.18592

    Hi, I am currently trying to extend my Umbraco Website with a custom section which should have a custom controller and a custom .cshtml view. I successfully managed to add the section by adding the following line in applications.config:

    <add alias="gamesection" name="Spielverwaltung" icon="icon-game" sortOrder="8" />
    

    I also added the following lines of codes inside Dashboard.config

      <section alias="StartupSpielverwaltungDashboardSection">
        <areas>
          <area>gamesection</area>
        </areas>
        <tab caption="Spielverwaltung übersicht">
          <control>/Spielverwaltung/Index</control>
        </tab>
      </section>
    

    and created a Controller (and obviously some views) in the following location:

    ~/Controllers/BackendController/SpielverwaltungController.cs

    Now the section does appear, but apparently Umbraco fails to find my controller. I get the following Error Message: "Request error: The URL returned a 404 (not Found) /Spielverwaltung/Index enter image description here

    Does anyone know why my controller isn't found? Where did I go wrong?

    Any help appreciated!

    Kind regards, Tim

  • Alex Brown 129 posts 620 karma points
    Jun 25, 2018 @ 14:12
    Alex Brown
    0

    Have you got the code for your controller?

  • Tim Gerhard 6 posts 86 karma points
    Jun 26, 2018 @ 05:55
    Tim Gerhard
    0

    This is my code:

    using System.Web.Mvc;
    
    namespace ludozh7.Controllers.BackendController
    {
        public class SpielverwaltungController : Controller
        {
            public ActionResult Index()
            {
                return View("~/Views/BackendViews/Index.cshtml");
            }
    
            public ActionResult Add()
            {
                return View("~/Views/BackendViews/Add.cshtml");
            }
        }
    }
    
  • Alex Brown 129 posts 620 karma points
    Jun 26, 2018 @ 07:00
    Alex Brown
    0

    Now I don't want to lead you down the wrong path but I normally see people use Angular controllers which call TreeControllers in the backend.

    Here's a good guide: https://skrift.io/articles/archive/sections-and-trees-in-umbraco-7/

  • Tim Gerhard 6 posts 86 karma points
    Jun 26, 2018 @ 07:03
    Tim Gerhard
    0

    I know this one would probably work, but I am more looking for a simple mvc view and a mvc controller. Obviously I will use angular inside the mvc view but I don't need a tree or anything like that.

  • Dave Woestenborghs 3504 posts 12134 karma points MVP 9x admin c-trib
    Jun 26, 2018 @ 07:37
    Dave Woestenborghs
    100

    Hi Tim,

    I guess you are trying to create a custom dashboard instead of a custom section ?

    There is a tutorial for that : https://our.umbraco.com/documentation/Tutorials/Creating-a-Custom-Dashboard/

    There is one issue in the tutorial : https://our.umbraco.com/forum/extending-umbraco-and-using-the-api/92396-custom-dashboard-and-sqlce

    But combining that with some bits from the skrift article mentioned here should get you started using angular.

    I would recommend you to use angular/webapi to extend the backend. It's the recommended way and it's much easier to get help from the community.

    Dave

  • Tim Gerhard 6 posts 86 karma points
    Jun 26, 2018 @ 07:48
    Tim Gerhard
    0

    Hi, I've decided to go with a html page and a angular controller which will then call my web api controller to retrieve some data from the database.

    I'll mark your answer as a solution though.

    Have a nice one and thanks for your help!

Please Sign in or register to post replies

Write your reply to:

Draft