Copied to clipboard

Flag this post as spam?

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


  • Craig100 1136 posts 2523 karma points c-trib
    Jun 08, 2012 @ 13:22
    Craig100
    0

    Razor text encoding problem

    Hi, in the macro for a gallery (below), I have a line:

     figClass = " class=/"fourthFigure/"";

    which outputs as <figure class=&quot;fourthFigure&quot;>

    How do I get it to output as <figure class="fourthFigure">

    Can't work out how.

    Any advice appreciated.

    Craig

     

    @{
        //Check the currentpage has a value in the property 'MediaFolder'
        if (Model.HasValue("mediaFolder"))
        {
            var MediaFolder = Library.MediaById(Model.mediaFolder);
            var width = Parameter.w;
            var height = Parameter.h;
            var count = 1;
            var figClass = "";
    
            <div class="galleryContainerDiv">
                @foreach (var picture in MediaFolder.Children)
                {
                    if(count == 4){
                      figClass = " class=/"fourthFigure/"";
                      count = 0;
                    }
                    <figure@figClass>
                        <img src="/ImageGen.ashx?image=@picture.umbracoFile&amp;AltImage=noimage-newslist.gif&amp;width=@width&amp;height=@height" width="@width" height="@height" alt="@picture.Name">
                        <figcaption>@picture.Name</figcaption>
                    </figure>
                    figClass = "";
                    count++;
                }
    
            </div>
        }
    }
  • Bert 128 posts 251 karma points
    Jun 08, 2012 @ 13:56
    Bert
    1

    change

    <figure@figClass>

    into

     

    <figure @Html.Raw(figClass)>
  • Craig100 1136 posts 2523 karma points c-trib
    Jun 08, 2012 @ 15:43
    Craig100
    0

    Thanks for that Bert!  I'd tried a few things including Html.Raw but around the line setting the figClass value but nothing seemed to work.

    Thanks again,

    Craig

  • Bert 128 posts 251 karma points
    Jun 08, 2012 @ 15:47
    Bert
    0

    *delete this post*

  • 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