Html.TextAreaFor在Chrome和Firefox中插入换行符

时间:2013-02-26 19:30:08

标签: c# asp.net-mvc-3

页面的模型有一个名为instructions的字符串属性,它显示在textarea中,无论是添加还是编辑对象,都会插入换行符,无法找到。

Html.TextAreaFor(m => m.Instructions)是唯一相关的代码。在Chrome和Firefox中,文本区域中会出现换行符,但不会出现在Internet Explorer中。

我在这里非常亏本。

1 个答案:

答案 0 :(得分:0)

在搜索了一些之后,我发现这与AntiXssLibrary有关。

这里有更多信息 http://forums.asp.net/t/1693760.aspx/1

从阅读本文来看,它听起来像是在MVC 4中修复过的 http://aspnet.codeplex.com/workitem/8848

如果您使用的是AntiXssLibrary和MVC3,则必须使用javascript手动删除换行符。