The type 'ScentSpider.Models.Prd' cannot be used as type parameter 'TContent' in the generic type or method 'UmbracoTemplatePage<TContent>'. There is no implicit reference conversion from 'ScentSpider.Models.Prd' to 'Umbraco.Core.Models.IPublishedContent'. ScentSpider
The name 'CurrentPage' does not exist in the current context
Hi, I have a custom model inherited from RenderModel:
and my view is inherits
Now in my view when I try to use
I get an error :
Any idea what I an doing wrong here. Thanks
Hi Fahad
You can use CurrentPage if inherits like that:
You can find some more details here: https://our.umbraco.org/documentation/Reference/Templating/Mvc/querying
CurrentPage is a dynamic object so the syntax will be shorter but some complex queries might not be doable with that type of object
Model.Content is strongly typed so when you are in visual studio you can take advantage of the intellisense
UmbracoViewPage hasn't dynamic objects and now it's a recommended way to do Umbraco development - avoid dynamics, it will be removed in version 8.
Thanks,
Alex
Hi Alex, Thanks for your response , I tried to inherits from
But I got error :
What is the "ScentSpider.Models.Prd" type?
How did you return "ScentSpider.Models.Prd" model from controller?
Is it code from controller?
Can you show all controller?
Controller code:
And my View is:
Thanks
Fahad, don't use CurrentPage with UmbracoViewPage.
Hi Alex, Could you please suggest how to insert grid ,I created using Umbraco in my page then.
Thanks
Fahad, try to use like that:
Hi Alex, sorry to be a pain. As I am using custom model when I try to use
I get an error :
Thanks
Fahad, try to change your view like that:
Because I don't see where do you use "ScentSpider.Models.Prd" model.
Hope it will help.
/Alex
Fahad,
Could you try:
@Html.GetGridHtml("ProductListLayout")
or
@Model.Content.GetGridHtml("ProductListLayout")
is working on a reply...