Copied to clipboard

Flag this post as spam?

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


  • Manish 373 posts 928 karma points
    Oct 30, 2017 @ 10:46
    Manish
    0

    Create drop down dynamically in child page

    Hi All

    I have create a property in parent page and a user can add comma separated value in text box. I want to use these comma separated values in a drop down which is in child pages.

    Is there any way to achieve this ?

    Thanks

  • Paul Seal 425 posts 2326 karma points MVP 3x c-trib
    Oct 30, 2017 @ 13:50
    Paul Seal
    0

    Hi Manish

    I would use some code like this:

    @{
        List<SelectListItem> dropdownValues = Model.Content.Parent.GetPropertyValue<string>("commaSeparatedValues").Split(',').Select(x => new SelectListItem() { Text = x, Value = x }).ToList();
    }
    
    @Html.DropDownListFor(m => m.PropertyName, dropdownValues, "Please Select...")
    
  • Manish 373 posts 928 karma points
    Oct 30, 2017 @ 13:52
    Manish
    0

    Thanks Paul

    Actually I need to show this drop-down in CMS on child pages how can i achieve this ?

    Thanks

  • Paul Seal 425 posts 2326 karma points MVP 3x c-trib
    Oct 30, 2017 @ 13:53
    Paul Seal
    0

    Have a look at the package called NuPickers. I bet there is an option there to base the source of a control on a value from a content item.

  • Manish 373 posts 928 karma points
    Oct 30, 2017 @ 13:54
    Manish
    0

    Let me try with package. Is there any example/code you used. Please share your exp here.

  • Paul Seal 425 posts 2326 karma points MVP 3x c-trib
    Oct 30, 2017 @ 14:04
    Paul Seal
    0

    I've only used the SQL table as a source, so far. But there are other sources you can use. Have a look here to see if you can do what you need to.

    https://github.com/uComponents/nuPickers/wiki/Data-Sources

  • Manish 373 posts 928 karma points
    Oct 30, 2017 @ 14:07
    Manish
    0

    I will check this and let you know here.

    Thanks Paul

Please Sign in or register to post replies

Write your reply to:

Draft