Razor 如何将ckeditor内部提供的数据保存到数据库中
你好,我是asp.net mvc的新手,我需要保存ck编辑器中给出的数据 我这样做是因为我从internet下载了ck编辑器并粘贴到了我的解决方案浏览器中 给定视图中的路径 路径如下:Razor 如何将ckeditor内部提供的数据保存到数据库中,razor,ckeditor,razorengine,Razor,Ckeditor,Razorengine,你好,我是asp.net mvc的新手,我需要保存ck编辑器中给出的数据 我这样做是因为我从internet下载了ck编辑器并粘贴到了我的解决方案浏览器中 给定视图中的路径 路径如下: <script src="~/ckeditor/ckeditor.js"></script> 如何将此数据保存到数据库中ckeditor的基本用法如下: @Html.TextArea("editor", htmlAttributes: new { name =
<script src="~/ckeditor/ckeditor.js"></script>
如何将此数据保存到数据库中ckeditor的基本用法如下:
@Html.TextArea("editor", htmlAttributes: new { name = "editor", id = "editor", rows = "10", cols = "180" })
并将您的ckeditor配置为:
<script>
CKEDITOR.replace('editor',
{
height: 450
});
</script>
CKEDITOR.replace('editor',
{
身高:450
});
在向httpPost控制器发布数据时,请执行以下操作:
[ValidateInput(false)] <-------
[HttpPost]
public ActionResult YourController(FormCollection formValues)
{
//You can get value of ckeditor as
var temp = formValues["editor"]; //it will have complete data inside ckeditor you can save it to database as the way you want.
}
[ValidateInput(false)]@user3496982我认为上面的代码足以让您使用ckeditor。@user3496982需要更多帮助??您好,数据是用html标记保存的,我们如何避免这种情况关于sumanthckeditor总是用html标记保存数据,您无法避免它,这是编辑器的功能,如果你不想用html标记保存数据,那么使用编辑器有什么用…@sumanthbim在job post屏幕中使用ckeditor,而在部分屏幕中查看数据数据数据数据也在读取html,因此我不需要在查看数据时使用该标记,因为数据保存在html标记之间的数据库中比如hello sql hello sql
[ValidateInput(false)] <-------
[HttpPost]
public ActionResult YourController(FormCollection formValues)
{
//You can get value of ckeditor as
var temp = formValues["editor"]; //it will have complete data inside ckeditor you can save it to database as the way you want.
}