开发者

How do you write a literal string in a Webmatrix Helper?

开发者 https://www.devze.com 2023-02-06 04:03 出处:网络
I\'ve tried getting the following helper to work...but I\'m scratching my head. @helper SimpleHelper()

I've tried getting the following helper to work...but I'm scratching my head.

@helper SimpleHelper()
{
    string message;
    message="<b>Hello</b>";
    @message
}

The text c开发者_JAVA百科omes out improperly encoded. With the lt; and gt; instead of the html tags.

Neither WriteLiteral(message) or @:message work.


Use the Html.Raw() helper in Razor to display that as an un-encoded string.

Here's the Razor quick-reference that Phil Haack put together recently.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号