2010-10-11 17 views
1

我在我的应用程序中使用CKEditor的,但我不知道怎么写的的CKEditor在asp.net

@注册大会=“”命名空间=“”的TagPrefix =“”%>

从在哪里我可以得到大会?

回答

0

答案将是

scrpt type = "text/javascript" src = "ckeditor/ckeditor.js"....close script 
//ckeditor is the folder that you have created in your application. 

script type="text/javascript" 
window.onload = function() 

{ 
    debugger 
    vartxtDemo = document.getElementByID('<%txtDemo.ClientID%'); 
    CKEDITOR.replace(txtDemo); 

}...//close the script 

,但在此之前,在您的应用程序中创建ckeditor文件夹并粘贴您已下载的内容,

2

web.config部分,你可以写:

<add tagPrefix="FredCK" namespace="FredCK.CKEditor" assembly="FredCK.CKEditor, Culture=neutral, PublicKeyToken=9ef91de3e191403a" /> 
1

其实,最好不要使用ASP.NET CKEditor控件,而是直接使用CKEditor。控制已过时(版本3.6而不是4.1)并且不是必需的。基本上,使用多行文本框,并使其成为CKEditor类。不要忘了给ckEditor.js添加到头部分:

的web.config

<configuration> 
    <system.web> 
     <httpRuntime requestValidationMode="2.0"/> 
     <compilation debug="true" targetFramework="4.0" /> 
    </system.web> 
</configuration> 

Test.aspx的

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> 

<html xmlns="http://www.w3.org/1999/xhtml"> 
<head runat="server"> 
    <title>ckeditor test page</title> 
    <script src="ckeditor/ckeditor.js" type="text/javascript"></script> 
</head> 
<body> 
    <form id="form1" runat="server"> 

    <p> 
     <asp:TextBox class="ckeditor" ID="CkeditorTextBox" runat="server" TextMode="MultiLine" Columns="80" Rows="10"> 
     Hi 
     </asp:TextBox> 
    </p> 

    <p> 
     <asp:Button ID="SubmitButton" runat="server" onclick="SubmitButton_Click" Text="Submit" /> 
    </p> 
    </form> 
</body> 
</html> 

Test.aspx文件。 cs

using System; 

public partial class Test : System.Web.UI.Page 
{ 
    protected void Page_Load(object sender, EventArgs e) 
    { 

    } 
    protected void SubmitButton_Click(object sender, EventArgs e) { 
     string CkEditorText = CkeditorTextBox.Text; 
     //add some processing here 
    } 
}