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 240 posts 431 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.

Please Sign in or register to post replies

Write your reply to:

Draft