Copied to clipboard

Flag this post as spam?

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


  • Gordon Saxby 1459 posts 1880 karma points
    Oct 16, 2012 @ 14:02
    Gordon Saxby
    0

    Dynamically choose Multi-Url Picker

    The site is v4.8.1 with uComponents v5 installed as well.

    I have a razor script that takes a parameter of the property alias. I then want to get the content from that item.

    menuAlias is either "siteMenu1" or "siteMenu2" - which are both Multi-Url Pickers.

        var menuAlias = Parameter.menuAlias;
    
        var siteMenu = Model.GetProperty(menuAlias);
    

    The above works but I then cannot do 

    if (siteMenu.Items.Count > 0)

    Can I declare siteMenu as the correct datatype so that the correct properties will be available?

  • Gordon Saxby 1459 posts 1880 karma points
    Oct 16, 2012 @ 14:49
    Gordon Saxby
    0

    I added 

    @using uComponents.DataTypes.MultiUrlPicker.Dto;

    and then changed the code to

    MultiUrlPickerState siteMenu = MultiUrlPickerState.Deserialize(Model.GetProperty(menuAlias).Value);

    and now it works!

Please Sign in or register to post replies

Write your reply to:

Draft