2015-06-11 35 views
0

定义配置我有以下的CKEditorCKEditor的:在页面

<%@ Register Assembly="CKEditor.NET" Namespace="CKEditor.NET" TagPrefix="CKEditor" %> 

<CKEditor:CKEditorControl ID="txtHtmlText" BasePath="~/Scripts/ckeditor/" 
     Toolbar="Bold|Italic|Underline|Strike|Subscript|Superscript|- |TextColor|BGColor|Font|FontSize 
JustifyLeft|JustifyCenter|JustifyRight|Justify|-|Outdent|Indent|- |NumberedList|BulletedList 
Cut|Copy|Paste|PasteText|PasteFromWord|-|HorizontalRule|Link|Unlink|- |Source|About"runat="server"></CKEditor:CKEditorControl> 

我想覆盖的CKEditor的config.js定义字数限制一个ASP.net用户控件。我在.ascx文件中使用了以下代码,并且出现错误

“未捕获的ReferenceError:CKEDITOR未定义”。请帮助

<script type="text/javascript"> 

    CKEDITOR.replace('txtHtmlText', 
{ 
    wordcount: { 
     // Whether or not you want to show the Paragraphs Count 
     showParagraphs: false, 

     // Whether or not you want to show the Word Count 
     showWordCount: false, 

     // Whether or not you want to show the Char Count 
     showCharCount: true, 

     // Whether or not you want to count Spaces as Chars 
     countSpacesAsChars: false, 

     // Whether or not to include Html chars in the Char Count 
     countHTML: false, 

     // Maximum allowed Word Count, -1 is default for unlimited 
     maxWordCount: 500, 

     // Maximum allowed Char Count, -1 is default for unlimited 
     maxCharCount: 500 
    } 
}); 
</script> 

回答

0

@Vinayak Prabha,

尝试通过维克拉姆的建议。然而,一个问题?

CKEditor ID“txtHtmlText”是服务器ID,如果您必须在Java脚本中使用,您应该使用客户端ID。

尝试这样

var ckEditorClientID = "#<%=txtHtmlText.ClientID %>";

CKEDITOR.replace(ckEditorClientID,