I have found myself in the unenviable position of upgrading an Umbraco site produced by another set of developers.
Umbraco 7 seems absolutely fantastic so far but I have just a few areas that I'm really struggling with...
The previous developers created a json file on startup that lists a large number of regions and countries etc.. that is then used for Google maps.
The challenge is that the countries are linked to regions with the "multinodetreepicker" and the Umbraco 6 site currently works with this code:
countries = @item.HasValue("countries") ? Umbraco.TypedContent(@item.GetPropertyValue("countries").ToString().Split(',')).Where("Visible").OrderBy("Name").Select(c => new
{
id = c.Id,
name = c.GetPropertyValue(Localise.Localise.GetPropAlias(c, "countryName", Culture)),
isocode = c.GetPropertyValue("isoCode"),
My Challenge is that this worked on Umbraco 6 with the multinodetreepicker (not version 2) but the MultinodeTreepicker2 doesn't seem to return any countries even though they are in the CMS.
Is there a better way that I should be querying this data and perhaps not using "Umbraco.TypedContentAtXPath" at all?
I've been trying to use the examples and excellent support items already in the forum but I cannot seem to find anything that helps me with this specific challenge; especially since this code doesn't seem to be able to use content.Model ???
I'm sorry if I'm not asking the question correctly or misunderstanding Umbraco.
Fixed this myself by simply taking some time to understand Umbraco (and .net in general) a little more.
posting the fix just in case it helps anyone else.
Cheers,
Splinx
countries = item.GetPropertyValue<IEnumerable<IPublishedContent>>("countries").Any() ?
item.GetPropertyValue<IEnumerable<IPublishedContent>>("countries").Select(c => new
{
id = c.Id,
name = c.GetPropertyValue(Localise.Localise.GetPropAlias(c, "countryName", Culture)),
isocode = c.GetPropertyValue("countryIsoCode")
Querying multinodetreepicker2 from startuphandler
Hi Guys,
I have found myself in the unenviable position of upgrading an Umbraco site produced by another set of developers.
Umbraco 7 seems absolutely fantastic so far but I have just a few areas that I'm really struggling with...
The previous developers created a json file on startup that lists a large number of regions and countries etc.. that is then used for Google maps.
The challenge is that the countries are linked to regions with the "multinodetreepicker" and the Umbraco 6 site currently works with this code:
My Challenge is that this worked on Umbraco 6 with the multinodetreepicker (not version 2) but the MultinodeTreepicker2 doesn't seem to return any countries even though they are in the CMS.
Is there a better way that I should be querying this data and perhaps not using "Umbraco.TypedContentAtXPath" at all?
I've been trying to use the examples and excellent support items already in the forum but I cannot seem to find anything that helps me with this specific challenge; especially since this code doesn't seem to be able to use content.Model ???
I'm sorry if I'm not asking the question correctly or misunderstanding Umbraco.
Thanks in advance,
Splinx
Hi Guys,
Fixed this myself by simply taking some time to understand Umbraco (and .net in general) a little more.
posting the fix just in case it helps anyone else.
Cheers, Splinx
is working on a reply...