将 CKEditor 集成到博客的剃刀视图 Create.cshtml 编辑器字段
对于博客 MVC 3 应用程序。我已经有了 CRUD 功能,并且为了创建帖子内容,我想使用 CKEditor。所以:
对于我现在拥有的 Create.cshtml 视图
<div class="editor-field">
@Html.EditorFor(model => model.Content )
@Html.ValidationMessageFor(model => model.Content)
</div>
,CKEditor 对于简单的 textarea> 工作得很好。例如:
textarea class="ckeditor" id="editor1" rows="10" cols="20">Sample Text</textarea>
<input type="submit" name="submit" value="Submit" />
我的问题是如何将其与视图中的模型属性关联,这样它将显示 CKEditor,而不是简单的多行文本框。提前致谢!
For a blog mvc 3 app. I have already the CRUD functionality and for Creating the content of a post I want to use CKEditor. So:
For Create.cshtml View I have
<div class="editor-field">
@Html.EditorFor(model => model.Content )
@Html.ValidationMessageFor(model => model.Content)
</div>
Now, CKEditor works fine for simple textarea> elements and a submit button.For example:
textarea class="ckeditor" id="editor1" rows="10" cols="20">Sample Text</textarea>
<input type="submit" name="submit" value="Submit" />
My question is how to associate it with the model property in a view so instead of simple multiline textbox it will show CKEditor. Thanks in advance!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
好的,就这么简单:
Ok, is as simple as this: