代码改变世界

MVc 文本框设计样式

2015-07-17 09:27  熠旸  阅读(1032)  评论(1编辑  收藏  举报

<td colspan="6">

<textarea class="content" name="content" style="height:250px;width:690px">@(Model.content)</textarea>(或者)

@Html.TextAreaFor(it => it.content, 19, 100, new {style="margin:8px 0 0 0;width:719px;" })

</td>

 

 

js显示样式

 

$(function () {
//正文文本框的样式的实现
KindEditor.ready(function (K) {
K.create('textarea[class="content"]', {
allowImageUpload: true,
cssPath: '@Url.Content("~/KindEditor/plugins/code/prettify.css")',
uploadJson: '@Url.Content("~/KindEditor/Upload")',
fileManagerJson: '@Url.Content("~/KindEditor/Browse")',
allowFileManager: true,
afterCreate: function () { this.sync(); },
afterBlur: function () {
this.sync();
}
});
});

 

当输入特殊字符时可能会报出输入危险字符

这是在conntrator中的Edit前要加入    [ValidateInput(false)] 取消非法验证