簡體   English   中英

asp.net和vb.net無法識別ckeditor值

[英]ckeditor value is not recognized by asp.net and vb.net

我在我的asp.net和vb.net Web應用程序中集成了ckeditor。 以前這個網絡應用程序使用bootstrap-wysihtml5。 但現在客戶需要使用ckeditor。

為了集成ckeditor,我做了以下事情:

我使用的是ckeditor_4.4.1。 我已經在根目錄中復制了ckeditor文件夾。 並將其鏈接到母版頁中,如下所示。

   <%@ Master Language="VB" CodeFile="E4.master.vb" Inherits="_resx_E4" %>
   <!doctype html>
   <html lang="en">
   <head runat="server">
       <title></title>
       <meta name="robots" content="noindex, nofollow">
       <meta name="googlebot" content="noindex, nofollow">
       <link href='https://fonts.googleapis.com/css?family=Roboto:400,300,100' rel='stylesheet' type='text/css'>
       <script src="/ckeditor/ckeditor.js" type="text/javascript"></script>
   </head>

我沒有更改內容頁面的標題。 它就像以下一樣

<%@ Page Page Title="" Language="VB" MasterPageFile="~/_resx/E4.master" AutoEventWireup="false" CodeFile="new.aspx.vb" Inherits="E4_Jobs_new" ValidateRequest="false" %>
<%@ Page    <%@ Register Src="~/_controls/ucApplicationQuestions.ascx" TagPrefix="Application"
TagName="Questions" %>
<asp:Content ID="Content1" ContentPlaceHolderID="MainContent" runat="Server">

最后是內容頁面中的文本區域代碼

<div><label>Description (required)</label>
  <div>
    <textarea runat="server" id="txtDescription" name="txtDescription" class="ckeditor" style="width: 98%; height: 250px;"  ></textarea>
  </div>
</div>

ckeditor工具欄顯示在textarea上。 但是網站無法識別ckeditor字段中寫入的值,也無法將這些值保存在數據庫中。 即使我在文字區域寫完后提交表格,也不允許我提交表格,因為描述字段必須有一些文字。 但實際上我已經在textarea中寫過或者從word文件中復制粘貼。 但它仍然沒有任何價值。

請幫我代碼

我找到了答案。 我想我必須分享它; 以防其他人面臨同樣的問題。

以下是我遵循的步驟。

  1. 從鏈接http://ckeditor.com/download下載了ckeditor

  2. 復制項目文件夾下的整個文件夾。

  3. 在母版頁中添加了以下行以添加ckeditor的引用

     <script src="/ckeditor/ckeditor.js" type="text/javascript"></script> <script src="/ckeditor/adapters/jquery.js" type="text/javascript"></script> <script src="/ckeditor/ckeditor_custom.js" type="text/javascript"></script> 
  4. 更改了特定textarea的類

     <textarea runat="server" id="txtDescription" name="txtDescription" class="ckeditor" style="width: 98%; height: 250px;" ></textarea> 
  5. 在內容頁面的底部添加了以下javascript函數

     $('#' + '<%= btnSave.ClientID%>').mousedown(function () { for (var i in CKEDITOR.instances) { CKEDITOR.instances[i].updateElement(); } }); 

而已。

這里btn.save是提交數據的按鈕

謝謝

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM