MVCContrib Grid - 显示回车符
如何在 MVCContrib 网格内显示回车符?我尝试将返回值替换为 "
,但是实际上在我的显示屏中显示
""test
test"
<div id="noteList">
@Html.Grid(Model).Columns(column => {
column.For(x => x.TimeStamp);
column.For(x => x.UserName);
column.For(x => x.Note.Replace("\r\n","\"<br>\"")).Named("Note");
}).Attributes(Style => "text-aligh: center", @Class => "linkGrid")
</div>
有没有办法让浏览器渲染原始返回的“\r\n”?
How do you show carriage returns inside a MVCContrib Grid? I've tried replacing the returns with "<br>"
, however that is actually showing a <br>
in my display "test<br>test"
<div id="noteList">
@Html.Grid(Model).Columns(column => {
column.For(x => x.TimeStamp);
column.For(x => x.UserName);
column.For(x => x.Note.Replace("\r\n","\"<br>\"")).Named("Note");
}).Attributes(Style => "text-aligh: center", @Class => "linkGrid")
</div>
Is there a way to get the browser to render the original return's "\r\n"?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您可以使用自定义列:
但更安全、恕我直言,更强大的解决方案是使用自定义 HTML 帮助器:
然后:
You could use a custom column:
But a safer and IMHO a more robust solution would be to use a custom HTML helper:
and then: