CKEDITOR4向控制器返回空值

时间:2018-10-31 14:36:00

标签: visual-studio-2017 asp.net-core-2.1 ckeditor4.x

我在asp.net core mvc中对CKEDTOR4有问题。它将null返回给控制器。这是我的代码。你能帮我吗?

控制器:

public IActionResult AddProducts(Products product, IFormFileUploadImage,string CommentText)
{
    ProductRepository blProduct = new ProductRepository();
    string webRootPath = _hostingEnvironment.WebRootPath;
    //var temp = formValues["Product.Summery"];
    string contentRootPath = _hostingEnvironment.ContentRootPath;
    product.Image = UploadImage.FileName;
    string path = webRootPath + "\\Files\\UploadImages\\ax.jpg";
    UploadImage.OpenReadStream().ResizeImageByWidth(500, path, Utilty.ImageComperssion.Normal);

    if (blProduct.Add(product))
    {
        ModelState.AddModelError("Error", "success");
    }
    else
    {
        ModelState.AddModelError("Error", "Fail");
    }

    return View();
}
}

视图:

<div class="form-group">
   <label asp-for="Product.Summery" class="control-label"></label>
   <div class="controls">
      <textarea asp-for="Product.Summery"  class="ckeditor" id="editor1"></textarea>

      <span asp-validation-for="Product.Summery" class="text-danger"></span>
   </div>
</div>            
<script type="text/javascript">       
    CKEDITOR.replace('Product.Summery');        
</script>
<script src="@Url.Content("~/ckeditor/ckeditor.js")"></script>

0 个答案:

没有答案