Copied to clipboard

Flag this post as spam?

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


  • R2-D2 11 posts 31 karma points
    Mar 14, 2012 @ 11:17
    R2-D2
    0

    Can't get the property when it's a variable

    Im trying to show all properties adding a variable.

    This sentence show the image Url:

    <h3>@Umbraco.GetMediaUrl(DynamicModel.Id, "carouselPic1")</h3>

    But when i do this i get NOTHING.

      @for(int x=1; x<6; x++)
        {
           var property = string.Concat("carouselPic", x);                 
           @*<h3>test: @Umbraco.GetMediaUrl(DynamicModel.Id, property)</h3>*@                               
        }

    Does anyone knows where is the problem? is because the variable isn't the same class of the property?

    Thanks a lot

  • Rodion Novoselov 694 posts 859 karma points
    Mar 14, 2012 @ 11:55
    Rodion Novoselov
    0

    Hi. Hm... As far as I know "@* ---- *@" means a comment. Perhaps you need just to uncomment your "<h3>bla-bla-bla</h3>"?

  • R2-D2 11 posts 31 karma points
    Mar 14, 2012 @ 12:06
    R2-D2
    0

    OOPS! of course, its commented cause when i run it the application crash... just forget the coments ;))

    @for(int x=1; x<6; x++)
        {
           var property = string.Concat("carouselPic", x);                 
           <h3>test: @Umbraco.GetMediaUrl(DynamicModel.Id, property)</h3>                            
        }

    This still dont work

Please Sign in or register to post replies

Write your reply to:

Draft