Skip to content

Instantly share code, notes, and snippets.

@uniquelau
Last active December 16, 2015 14:49
Show Gist options
  • Save uniquelau/5451831 to your computer and use it in GitHub Desktop.
Save uniquelau/5451831 to your computer and use it in GitHub Desktop.
I am not a number, I am a free man!

Razor Error

Data stored inside a 'Simple Text Editor'

Errors

A

<script></script>

B

<h1></h1>

C

<h1>Hello</h1>

D

<script></script>
<!-- -->

Works

A

<script></script>
<br />

B

<h1></h1>
>

C

<script></script>
<

Razor

@contactNode.mobileTrackingCode.ToString()

Error

Error loading Razor Script [Razor]ProductContact.cshtml The best overloaded method match for 'System.Web.WebPages.Html.HtmlHelper.Raw(string)' has some invalid arguments

Hacky bad, awful, rubbish solution that would make a content editor want to cry...

Add a HTML tag to the data that is stored in Umbraco.

e.g.

 ...
...
...
...
    if (typeof(conv_handler) == 'function') {
        conv_handler(opt);
    }
}
</script>
<br /><!-- when we have this break everything works! yaaahoooooooooo!! -->
@Jeavon
Copy link

Jeavon commented Apr 24, 2013

I think it's a bug! Workaround to check type?
@using umbraco.MacroEngines
@{
if (Model.simple.GetType() == typeof(DynamicXml)){
@Html.Raw(Model.simple.ToXml().ToString())
} else {
@Html.Raw(Model.simple.ToString())
}
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment