从控制器返回html字符串并在视图中显示 [英] Return html string from controller and display in view

查看:119
本文介绍了从控制器返回html字符串并在视图中显示的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何返回带有包含<li>元素的字符串属性的模型并将其显示在视图中? 如果我只写@ Model.Messages,它将显示所有字符串.我需要html格式.

How can I return a model with a string propertie containing <li> elements and display it in view? If I just write @Model.Messages it shows all the string.. i need it in html format.

推荐答案

您没有说您使用的是哪个渲染引擎:

You don't say which rendering engine you're using:

MVC3:
@ Html.Raw(Model.Description)

MVC3:
@Html.Raw(Model.Description)

这篇关于从控制器返回html字符串并在视图中显示的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆