Copied to clipboard

Flag this post as spam?

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


  • k 256 posts 654 karma points
    May 15, 2019 @ 12:10
    k
    0

    Checkboxlist Umbraco 8

    Hello,

    How can i get the values from a checkboxlist please ?

    Thanks,

    Kusum

  • k 256 posts 654 karma points
    May 15, 2019 @ 12:27
    k
    0

    I have used the below :

    @{
    if (Model.HasValue("superHeros")){
        <ul>
            @foreach(var item in Model.SuperHeros) {
                <li>@item</li>
            }
        </ul>
    }
    

    } but getting the below error :

    Compiler Error Message: CS1061: 'IPublishedContent' does not contain a definition for 'values' and no accessible extension method 'values' accepting a first argument of type 'IPublishedContent' could be found (are you missing a using directive or an assembly reference?)
    
  • k 256 posts 654 karma points
    May 16, 2019 @ 16:42
    k
    101

    Solution:

     @{
                                              var tags = Model.Value<string[]>("values");
                                              foreach(var tag in tags)
                                              {
                                              @tag;
                                              }
    
                                              }
    
  • Carlos Mosqueda 244 posts 435 karma points
    Mar 16, 2020 @ 04:30
    Carlos Mosqueda
    0

    This is definitely not in the documentation and really should be. But this worked for me.

  • 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