Copied to clipboard

Flag this post as spam?

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


  • k 217 posts 540 karma points
    1 week ago
    k
    0

    Checkboxlist Umbraco 8

    Hello,

    How can i get the values from a checkboxlist please ?

    Thanks,

    Kusum

  • k 217 posts 540 karma points
    1 week ago
    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 217 posts 540 karma points
    1 week ago
    k
    0

    Solution:

     @{
                                              var tags = Model.Value<string[]>("values");
                                              foreach(var tag in tags)
                                              {
                                              @tag;
                                              }
    
                                              }
    
Please Sign in or register to post replies

Write your reply to:

Draft