1
votes
I am new to Umbraco. I am currently using Umbraco 7.0. I have created a Razor 
macro with a parameter that will access property from home template page. In My Macro  
due to space only first word of string displays and  rest of the string is not   
displayed. property    
name is sliderHeading with value : My First Slide. Macro inserted in the template is  
as follows :-

@Umbraco.RenderMacro("HomePageSlider", new {mediaId="1084",    
[email protected]("sliderHeading")})  
// where sliderHeading is macro parameter.

Macro definition :-
@inherits umbraco.MacroEngines.DynamicNodeContext

@if (Parameter.mediaId != null)
{
 var mediaFolder =  Library.MediaById(Parameter.mediaId);

 if (mediaFolder.Children.Any())
{

     foreach (var mediaItem in mediaFolder.Children)
        {
            <div class="cycle-slide" style="background- 
image:url(@mediaItem.umbracoFile)" [email protected]   
data-cycle-desc="Remember, you are not limited to image elements. You can display 
other HTML too." data-cycle-link="#"></div>

        }
}

}

So, in macro, parameter value is accessed by :- data-cycle-
[email protected].

Now my issue is that if property value is :- "My First Slide". Then it will give wrong output "My" on page. if property value is :- "My First Slide" with html space (&nbbsp;) in between Then it will give right output "My First Slide" on page.

How should I access parameter in Macro, so that it will give right output.

1

1 Answers

0
votes

Seems a bit simple but won't wrapping @Html.Raw or even @Raw round your code force the parameter to output with spaces?

Like:

data-cycle-title=@Raw(Parameter.sliderHeading)