我已將CKEditor.Net添加到我的ASP.NET Web應用程序項目中。當我嘗試文本使用JavaScript,它給這個錯誤CKEditor未定義
Error: 'CKEDITOR' is undefined
這是我的代碼插入,
HTML
<%@ Page Title="" Language="C#" MasterPageFile="~/Site.Master" AutoEventWireup="true" CodeBehind="Test.aspx.cs" Inherits="eLetters.Test" %>
<%@ Register Assembly="CKEditor.NET" Namespace="CKEditor.NET" TagPrefix="CKEditor" %>
<asp:Content ID="Content1" ContentPlaceHolderID="HeadContent" runat="server">
<script type="text/javascript">
function insertText(text) {
CKEDITOR.instances.insertText('text');
}
</script>
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="FeaturedContent" runat="server">
</asp:Content>
<asp:Content ID="Content3" ContentPlaceHolderID="MainContent" runat="server">
<CKEditor:CKEditorControl ID="CKEditor1" BasePath="/ckeditor/" runat="server"></CKEditor:CKEditorControl>
</asp:Content>
C#
protected void Button1_Click(object sender, EventArgs e)
{
Page.ClientScript.RegisterStartupScript(GetType(), "MyKey", "insertText('data');", true);
}
什麼時我在這裏做錯了嗎?
你到底想幹什麼?設置默認內容? – MikeSmithDev 2013-02-23 02:39:51
@MikeSmithDev我需要做的是,從按鈕點擊插入一些文本到CKEditor:http://stackoverflow.com/questions/15018700/insert-text-to-ckeditor-programtically – Nalaka526 2013-02-23 03:57:23