Copied to clipboard

Flag this post as spam?

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


  • Craig100 1093 posts 2382 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;
                    }
                    <[email protected]>
                        <img src="/[email protected]&amp;AltImage=noimage-newslist.gif&amp;[email protected]&amp;[email protected]" 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

    <[email protected]>

    into

     

    <figure @Html.Raw(figClass)>
  • Craig100 1093 posts 2382 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*

Please Sign in or register to post replies

Write your reply to:

Draft