Press Ctrl / CMD + C to copy this to your clipboard.
This post will be reported to the moderators as potential spam to be looked at
I am building a website using umbraco v8, In the controllers section I am writing a code that calls other featured items in my front end website. But I am unable to call the Archetype model in my c# code. I know that umbraco v8 doesn't support Archetypes anymore but does anyone how what to use instead? I have been searching on the internet for hours but I couldn't get anywhere. Any help would be much appreciated.
Here is the code:
public ActionResult RenderFeatured()
List<FeaturedItem> model = new List<FeaturedItem>();
const int HOME_PAGE_POSITION_IN_PATH = 1;
int homePageId = int.Parse(CurrentPage.Path.Split(',')[HOME_PAGE_POSITION_IN_PATH]);
IPublishedContent homePage = Umbraco.Content(homePageId);
ArchetypeModel featureditems = homePage.Value("featuredItems");
foreach (ArchetypeFieldModel item in featureditems)
string imageUrl = "";
ActionResult result = PartialView(PARTIAL_VIEW_FOLDER + "_Featured.cshtml");
hi, I suggest you use Nested Content or Block List
I have an Archetype field set which I can get an image from a Media Picker ok but am unable to retreive a simple textbox value. I know that when I haven't had UCPVC installed, in the following code, to get the H4 I'd just use fieldset.
You'd need to take one of two options:
Create your own Property Value Converter to convert the properties to a strongly typed model - However you won't be able to modify these properties in the Umbraco back office as ArcheType isn't available for v8.
(This is a better option), create a script to convert your Archetype properties into either Nested Content of Block Editor properties. You can parse and convert the JSON yourself to switch them around. This would, most likely, give you a much better long term situation.
is working on a reply...
Write your reply to:
Image will be uploaded when post is submitted