Press Ctrl / CMD + C to copy this to your clipboard.
This post will be reported to the moderators as potential spam to be looked at
Hi everybody
Is it possible to make linebreaks when using the "textarea" type in macros?
I have tried with <br> and pressing enter, but it seems to just override it and renders out the text without linebreaks.
<br>
// René
Hi René
When you say textarea in a macro did you then mean the multiple textbook.
If so the you can output the content of the field containing HTML like this
@Html.Raw(CurrentPage.PropertyAlias)
And I think remember to write the linebreaks like
Hope this helps.
/Dennis
Hi Dennis
There is no "Multiple Textbox" in the macro parameters, I can only choose "textbox or textarea".
This is the macro code where there should be linebreaks in:
@Model.MacroParameters["text"]
Is it possible to use "Html.Raw" with my code?
Yes you can use the @Html.Raw in the macroParameters.
I have made a code snippet for you.
@inherits Umbraco.Web.Macros.PartialViewMacroPage @{ var macroText = Model.MacroParameters["text"]; } @if (macroText != null) { @Html.Raw(macroText) }
Hope this helps,
Your solution works perfectly in the Richtext editor but not with Grids.
Do you have any idea why?
Hi René,
I am not sure that this is possible in the Grid layout, so perhaps you should make a feature request about this http://issues.umbraco.org/issues/U4
Maybe you could consider to make a normal field outside the grid layout using the data type multiple textbox.
Then you can use this code.
@inherits Umbraco.Web.Macros.PartialViewMacroPage
@if (CurrentPage.HasValue("propertyAlias")) { @Html.Raw(CurrntPage.propertyAlias) }
Or as you already know then you can use it with a macro parameter outside the grid layout.
is working on a reply...
Write your reply to:
Upload image
Image will be uploaded when post is submitted
Linebreaks when using Macro "textarea" type
Hi everybody
Is it possible to make linebreaks when using the "textarea" type in macros?
I have tried with
<br>
and pressing enter, but it seems to just override it and renders out the text without linebreaks.// René
Hi René
When you say textarea in a macro did you then mean the multiple textbook.
If so the you can output the content of the field containing HTML like this
And I think remember to write the linebreaks like
Hope this helps.
/Dennis
Hi Dennis
There is no "Multiple Textbox" in the macro parameters, I can only choose "textbox or textarea".
This is the macro code where there should be linebreaks in:
Is it possible to use "Html.Raw" with my code?
// René
Hi René
Yes you can use the @Html.Raw in the macroParameters.
I have made a code snippet for you.
Hope this helps,
/Dennis
Hi Dennis
Your solution works perfectly in the Richtext editor but not with Grids.
Do you have any idea why?
// René
Hi René,
I am not sure that this is possible in the Grid layout, so perhaps you should make a feature request about this http://issues.umbraco.org/issues/U4
Maybe you could consider to make a normal field outside the grid layout using the data type multiple textbox.
Then you can use this code.
@inherits Umbraco.Web.Macros.PartialViewMacroPage
Or as you already know then you can use it with a macro parameter outside the grid layout.
/Dennis
is working on a reply...