RTE text has a markup inside it - I suspect that its output through @img.textBox will be HTML-escaped. (And that's well-known Razor drawback - it still has no short syntax for unescaped output (like "<%=" vs "<%:" in legacy ASP.NET rendering engine).
Cheers for all the help, to make life easier ive just changed from RTE to textbx multiple which still does everything i want it to do so all working brilliantly now!
Sebastian, you have turned up to be right. I've just validate it (I like making everything sure on my own :-)) Text properties of a DynamicNode etc are returned as HtmlString, so there's really no need to bother about HTML encoding. Thanks for a tip.
Displaying Umbraco field
Hi all,
Loooking for a bit of help, i have a carousel (uses nivoslider package) which i am altering slightly.
What im trying to do is get it to display the contents on the RTE Small field named 'textBox' within the carousel.
foreach (dynamic img in nodes.Children)
{
if (img.HasValue("nivoSliderCaption"))
{
<div id="@img.Name" class="nivo-html-caption">
@Html.Raw(img.nivoSliderCaption)
</div>
}
if (img.HasValue("textBox"))
{
<div class="nivotext">
("<umbraco:Item field="textBox" runat="server"></umbraco:Item>")
</div>
}
}
The caption works all fine and for the if (img.HasValue("textBox")) if i just use some plain text for example
if (img.HasValue("textBox"))
{
<div class="nivotext">
@Html.Raw("hello")
</div>
}
It works fine and displays, but i want it to display the contents of the 'textBox' field, any ideas?
Thanks
Hmm I could be wrong, but won't this just work?
Jeroen
Little note of mine - since it's RTE it looks a bit more correct to use:
Why would you add Html.Raw to it? I thought RTE properties would work anyway.
Jeroen
RTE text has a markup inside it - I suspect that its output through @img.textBox will be HTML-escaped. (And that's well-known Razor drawback - it still has no short syntax for unescaped output (like "<%=" vs "<%:" in legacy ASP.NET rendering engine).
Nah, for the built-in Rich text editor datatype, Umbraco will automatically output the Raw HTML if you do @img.textBox.
Cheers for all the help, to make life easier ive just changed from RTE to textbx multiple which still does everything i want it to do so all working brilliantly now!
thanks for the help!
Sebastian, you have turned up to be right. I've just validate it (I like making everything sure on my own :-)) Text properties of a DynamicNode etc are returned as HtmlString, so there's really no need to bother about HTML encoding. Thanks for a tip.
is working on a reply...