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)
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
Umbraco.Web.Mvc.RenderController
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.
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?
Thanks!
Hi Megha,
To achieve this, please create content of type
Product
and choose the template asBrand
, 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 caseBrand
)Please see the documentation here https://docs.umbraco.com/umbraco-cms/reference/routing/custom-controllers#example-hijacking-route-requests-to-a-product-for-an-alternative-amp-template
Thanks !! It's working but when it return i got these error :
Hi Megha,
This is because the brand template expecting BrandModel, but your are return ProductModel.
CurrentPage is actually ProductModel because you are on the content of type Product (doctype), but using Brand Template.
or simply change to
ContentModel
is the base model, please go through the documentaion for better understanding.is working on a reply...