Copied to clipboard

Flag this post as spam?

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

  • Megha 10 posts 80 karma points notactivated
    Feb 08, 2023 @ 10:48

    How To call An Action In Umbraco Controller?

    Hello All,

    I created an Umbraco DocumentType with the alias Product and created a controller that inherits


    I added two Actions, one is the Product action and the other is called Brand.I have Document type & Template of Product name and Brand.

    enter image description here

    When I put the url like this: localHost/Product/Brand it shows: Page not Found

    So please help me How can I fire the Brand Action from the Product controller?


  • Dhanesh Kumar MJ 158 posts 512 karma points MVP c-trib
    Feb 09, 2023 @ 06:51
    Dhanesh Kumar MJ

    Hi Megha,

    To achieve this, please create content of type Product and choose the template as Brand, Publish the content and browse the URL from the Info tab or create content as above & browse like this https://domain/page-url?altTemplate=templatealias (in your case Brand)

    Please see the documentation here

  • Megha 10 posts 80 karma points notactivated
    Feb 09, 2023 @ 11:05

    Thanks !! It's working but when it return i got these error : enter image description here

  • Dhanesh Kumar MJ 158 posts 512 karma points MVP c-trib
    Feb 09, 2023 @ 11:26
    Dhanesh Kumar MJ

    Hi Megha,

    This is because the brand template expecting BrandModel, but your are return ProductModel.

       Public IActionResult Brand()
         return CurrentTemplate(CurrentPage);

    CurrentPage is actually ProductModel because you are on the content of type Product (doctype), but using Brand Template.

    @inherits Umbraco.Cms.Web.Common.Views.UmbracoViewPage<change to productmodel> in BrandTemplate cshtml file 

    or simply change to

     @using Umbraco.Cms.Core.Models
    @inherits Umbraco.Cms.Web.Common.Views.UmbracoViewPage<ContentModel>

    ContentModel is the base model, please go through the documentaion for better understanding.

Please Sign in or register to post replies

Write your reply to: