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
Hey Everyone,
I've installed the Terratype package using the Umbraco Backoffice. I created a Document Type Called "Map Item"
Here I have listed:
On the page I want to display the map, I created a "Map List (alias: mapList)" using Nested Content which where my client can easily add new map pins.
I'm trying to render the content but am having an error.
My code is as follows:
@inherits Umbraco.Web.Mvc.UmbracoTemplatePage @using Terratype; @{ Layout = "BasePage.cshtml"; } <section> @foreach (var record in Model.Content.mapList) { var name = record.GetValue<string>("title"); var map = record.GetValue<Terratype.Models.Model>("location"); @Html.Terratype(new Options { MapSetId = 1 }, map, @<text> @name is at @map.Position </text> ) } </section>
Each of these locations is going to be a project, which will require a popup with name, image, and description with a possible read more button.
If it's better to not go as nested content, how would I go the route of a foreach loop to pull in these "pages" dynamically to populate the map.
Thanks for your time.
Hi Rylan
Try this code:
@foreach (var record in Model.Content.GetPropertyValue<IEnumerable<IPublishedContent>>("mapList"))
Alex
Still not working :(
The code you have is not exactly as per Alex's example please ensure this is the same:
Sorry must have posted the wrong screenshot.
Change all of your .GetValue to .GetPropertyValue
.GetValue
.GetPropertyValue
I've done that now and still an error. Sorry, I'm more of a designer / front end developer!
Here is my document type:
I double checked and the alias is "mapList".
is working on a reply...
Write your reply to:
Upload image
Image will be uploaded when post is submitted
Nested Content with TeraType
Hey Everyone,
I've installed the Terratype package using the Umbraco Backoffice. I created a Document Type Called "Map Item"
Here I have listed:
On the page I want to display the map, I created a "Map List (alias: mapList)" using Nested Content which where my client can easily add new map pins.
I'm trying to render the content but am having an error.
My code is as follows:
Each of these locations is going to be a project, which will require a popup with name, image, and description with a possible read more button.
If it's better to not go as nested content, how would I go the route of a foreach loop to pull in these "pages" dynamically to populate the map.
Thanks for your time.
Hi Rylan
Try this code:
Alex
Still not working :(
The code you have is not exactly as per Alex's example please ensure this is the same:
Sorry must have posted the wrong screenshot.
Change all of your
.GetValue
to.GetPropertyValue
I've done that now and still an error. Sorry, I'm more of a designer / front end developer!
Here is my document type:
I double checked and the alias is "mapList".
is working on a reply...