Copied to clipboard

Flag this post as spam?

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


  • Andrew Unger 45 posts 148 karma points
    May 11, 2020 @ 14:05
    Andrew Unger
    0

    issues rendering image from archtype "Compiler Error Message: CS0103: The name 'image' does not exist in the current context"

    I have a simple archtype that has a text string and media picker and I am having issues rendering the image. I get this error "Compiler Error Message: CS0103: The name 'image' does not exist in the current context error". I can render the text string fine so I'm not sure what the issue could be. I also checked the alias to make sure it was correct as well. Any help would be appreciated.

     @if(node.HasValue("housePod")){
            var items = node.GetPropertyValue<IEnumerable<IPublishedContent>>("housePod");
            foreach(var item in items){  
    
                <li class="accordion-item is-active" data-accordion-item>
                <a href="#" class="accordion-title"><div class="orangeCircle">1</div><u>@item.GetPropertyValue("houseName")</u></a>
                <div class="accordion-content" data-tab-content >
                if(item.HasValueImage("houseImage"))
                {
                    var image = item.GetPropertyValue<IPublishedContent>("houseImage");
                    <img src="@image.Url" alt="image">
                }
                </div>
                  </li> 
            }
        }
    
  • Andrew Unger 45 posts 148 karma points
    May 11, 2020 @ 14:30
    Andrew Unger
    100

    Never mind I'm a dope I had forgot to put a @ after the razor code goes back to html

  • 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