2010-10-11 7 views
1

je dois utiliser un ckeditor dans ma demande, mais je ne sais pas comment écrire leckeditor en asp.net

@ Register Assembly = "" Namespace = "" TagPrefix = "" %>

De où je pourrais obtenir l'assemblée?

Répondre

0

La réponse sera

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 

mais avant créez un dossier ckeditor dans votre application et collez le contenu que vous avez téléchargé,

2

Dans web.config section, vous pouvez écrire:

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

En fait, il est préférable de ne pas utiliser le contrôle ASP.NET CKEditor mais d'utiliser directement CKEditor. Le contrôle est obsolète (version 3.6 au lieu de 4.1) et non nécessaire. Fondamentalement, utilisez une zone de texte multiligne et faites-le de la classe CKEditor. Ne pas oublier d'ajouter les ckEditor.js à la section de tête:

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 
    } 
}