Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • Martin 278 posts 662 karma points
    Apr 08, 2015 @ 16:26
    Martin
    0

    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.

    \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>
      }
    }
    
  • Antoine 176 posts 1494 karma points
    Apr 08, 2015 @ 16:50
    Antoine
    0

    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:

    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.

     

     

  • Martin 278 posts 662 karma points
    Apr 08, 2015 @ 17:04
    Martin
    0

    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

  • Antoine 176 posts 1494 karma points
    Apr 08, 2015 @ 19:43
    Antoine
    101

    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:

    @{
        var multiUrlPicker = Model.Items.First().GetValue<dynamic>("multiUrlPicker");
    if (Enumerable.Any(multiUrlPicker)) { <ul> @foreach (var item in multiUrlPicker) { <li><a href="@item.url" target="@item.target">@item.name</a></li> } </ul> } }
  • Keith R Hubbard 175 posts 403 karma points
    Apr 09, 2015 @ 00:04
    Keith R Hubbard
    0

    Just what i needed!!!

  • Martin 278 posts 662 karma points
    Apr 09, 2015 @ 09:57
    Martin
    0

    Thanks Antoine, that works great. Really nice package. What are your future plans for it?

  • Antoine 176 posts 1494 karma points
    Apr 09, 2015 @ 19:21
    Antoine
    0

    We are preparing a new version that we will release soon with very nice features. Be paciente for just a few days :)

  • Jason Prothero 422 posts 1243 karma points MVP c-trib
    Apr 22, 2015 @ 05:49
    Jason Prothero
    0

    Will the GetValue<>() method to work with a Property Value Converter?

     

    Thanks,
    Jason 

  • Antoine 176 posts 1494 karma points
    Apr 22, 2015 @ 08:41
    Antoine
    0

    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.

     

  • Jason Prothero 422 posts 1243 karma points MVP c-trib
    Apr 22, 2015 @ 16:54
    Jason Prothero
    0

    OK, just wanted to see if it made in into 1.0.2.  Thanks!

     

    -Jason

  • Antoine 176 posts 1494 karma points
    May 03, 2015 @ 11:53
    Antoine
    0

    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

     

  • Jason Prothero 422 posts 1243 karma points MVP c-trib
    May 04, 2015 @ 17:43
    Jason Prothero
    0

    Great, thanks!

     

    -Jason

Please Sign in or register to post replies

Write your reply to:

Draft