I really like LeBlender and im trying to use it with the Multi Url Picker datatype package.
Im having some trouble with my razor and trying to make it work.
Ive created a Blender Editor named Related Link (alias relatedLink) and added a property of Multi Url Picker (alias multiUrlPicker), using the Multi Url Picker.
My partial follows the Multi Url Picker code, but im getting the following error.
\Views\Partials\Grid\Editors\RelatedLink.cshtml(6): error CS1061:
'Lecoati.LeBlender.Extension.Models.BlenderModel' does not contain a
definition for 'Content' and no extension method 'Content' accepting a
first argument of type
'Lecoati.LeBlender.Extension.Models.BlenderModel' could be found (are
you missing a using directive or an assembly reference?)
What am I missing or getting wrong?
Any help would be grateful
Martin
@inherits UmbracoViewPage<Lecoati.LeBlender.Extension.Models.BlenderModel>
@using RJP.MultiUrlPicker.Models;
@{
var multiUrlPicker = Model.Content.GetPropertyValue<MultiUrls>("multiUrlPicker");
if (multiUrlPicker.Any())
{
<ul>
@foreach (var item in multiUrlPicker)
{
<li><a href="@item.Url" target="@item.Target">@item.Name</a></li>
}
</ul>
}
}
Thanks for your feedback. Basicaly, the model exposed to the partial view is a BlenderModel, not an Umbraco RenderModel. So, BlenderModel doesn't have a definition for 'Content'.
A BlenderModel has a list of item "Items" and each item contains property values.
So in your case, it will be:
var multiUrlPicker = Model.Items.First().GetValue<MultiUrls>("multiUrlPicker");
Does it make sense?
Let me know if it doesn't work, I can try it from my side.
LeBlender with Multi Url Picker
Hi,
I really like LeBlender and im trying to use it with the Multi Url Picker datatype package.
Im having some trouble with my razor and trying to make it work.
Ive created a Blender Editor named Related Link (alias relatedLink) and added a property of Multi Url Picker (alias multiUrlPicker), using the Multi Url Picker.
My partial follows the Multi Url Picker code, but im getting the following error.
What am I missing or getting wrong?
Any help would be grateful
Martin
Hi Martin,
Thanks for your feedback. Basicaly, the model exposed to the partial view is a BlenderModel, not an Umbraco RenderModel. So, BlenderModel doesn't have a definition for 'Content'.
A BlenderModel has a list of item "Items" and each item contains property values.
So in your case, it will be:
Does it make sense?
Let me know if it doesn't work, I can try it from my side.
Hi Antoine,
Thanks for the quick reply. I've added your reference, but im now getting the following.
Object reference not set to an instance of an object.
Thanks
Hi Martin,
There is a convertion issue with "MultiUrls" that I have to check within the LeBlender Core.
Anyway, for now you can just use dynamic object instead:
Just what i needed!!!
Thanks Antoine, that works great. Really nice package. What are your future plans for it?
We are preparing a new version that we will release soon with very nice features. Be paciente for just a few days :)
Will the GetValue<>() method to work with a Property Value Converter?
Thanks,
Jason
Hi Jason
Not for now, we have an issue with the Property Value Converter, I will upload a parche soon, dynamic object can be used for now instead.
OK, just wanted to see if it made in into 1.0.2. Thanks!
-Jason
Hi Jason, Hi Martin
Now GetValue<> method works with Property Value Converter in LeBlender 1.0.3. So you can use multiUrlPicker, ArchetypeModel and else ...
Cheers
Antoine
Great, thanks!
-Jason
is working on a reply...