I tend to use JSON in MVC, then just create a helper method to convert the JSON to a dictionary:
public static class StringExtensions
{
public static T DeserializeJsonTo<T>(this string json)
{
return new JavaScriptSerializer().Deserialize<T>(json);
}
}
Then do something like this to get the values:
var cell = "cel1";
var widgets = Model.Content.GetPropertyValue<string>("widgets")
.DeserializeJsonTo<Dictionary<string, int[]>>();
if(widgets.ContainsKey(cell))
{
var nodeIds = widgets[cell];
// Process node ids
}
Umbraco 6 compatibility?
Will this currently work or are there plans to make this work with umb 6?
Hey Summit
This should work with V6 as is (I'm currently using it on a few v6 projects myself with no problems)
Many thanks
Matt
Great. Thanks
How to fetch the id's in MVC? Should it be saved as xml or JSON?
Kind regards
Anders
Hey Anders
I tend to use JSON in MVC, then just create a helper method to convert the JSON to a dictionary:
Then do something like this to get the values:
Hope that helps
Matt
Thanks - will try that
Kind regards
Anders
is working on a reply...