Copied to clipboard

Flag this post as spam?

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


  • Ruslan 6 posts 97 karma points
    Apr 18, 2016 @ 20:58
    Ruslan
    0

    Set values in CheckBox List code behind

    Hi all, I have such code that created new node in Umbraco.

     IContent story = contentService.CreateContent(model.StoryTitle, folderId, "successStory", 0);
     story.SetValue("storyStates", model.States);
    

    How I can set value in CheckBox List property?

  • Dan Diplo 1505 posts 5911 karma points MVP 4x c-trib
    Apr 19, 2016 @ 19:00
    Dan Diplo
    101

    As far as I remember a checkbox list contains a comma-separated list of Ids. So you can set it like:

    story.SetValue("checkboxList", "1,2,3,4,5");
    

    or

    var values = new int[] { 1, 2, 3, 4, 5 };
    story.SetValue("checkboxList", String.Join(",", values));
    
  • Ruslan 6 posts 97 karma points
    Apr 19, 2016 @ 21:28
    Ruslan
    0

    Dan Diplo Thank you very much! It's solved my problem.

  • This forum is in read-only mode while we transition to the new forum.

    You can continue this topic on the new forum by tapping the "Continue discussion" link below.

Please Sign in or register to post replies