The cold heart of ASP. NET2.0 text editor FCKeditor
Author: qingyueer
Home page:Http://blog.csdn.net/21aspnet/Time: 2007.4.9
FCKeditor is currently the best html text editor. If you still don't understand it, you will understand it.
:
Why is FCKeditor cold? This is not a big bang, it is a little troublesome to use, the following details how to deal with this stuff.
1. The official website of FCKeditor is:Http://www.fckeditor.net/download
FCKeditor 2.4.2 is the latest version.
Download from this page:Http://sourceforge.net/project/showfiles.php? Group_id = 75348
:
Download two zip packages, fckeditor2.4.2.zip and FCKeditor. NET.
Note:
FCKeditor2.4.2.zip is the latest Javascript file and image;
FCKeditor.NET.zip is called by ASP. NET.DLLIn.
2.After the data is extractedFckeditor directoryCopy the entire file to the website.
3.Decompress the fckeditor.net.zip package and find it in the FCKeditor. Net_2.2/bin/Debug directory.FredCK. FCKeditorV2.dll. Other files are useless.FredCK. FCKeditorV2.dllCopy to our website and createBin directory.
4.ReferenceFredCK. FCKeditorV2.dll.
Step 1:
Step 2:
5. Import the toolbox.
Under the toolboxRight-click
Click "select item ". Pop-up window:
ClickBrowse and find the directory where the dll is located.
The FCKeditor Control is displayed in the toolbox.
6. DragFCKeditor to the page
7. Configure WebConfig
<? Xml version = "1.0"?>
<! --
Note: In addition to manually editing this file, you can also use
Web management tools to configure application settings. You can use
"Website"-> "Asp. Net configuration" option.
The complete list of settings and comments is displayed in
In machine. config. comments, this file is usually located in
/Windows/Microsoft. Net/Framework/v2.x/Config
-->
<Configuration>
<Deleetask>
<Add key = "FCKeditor: BasePath" value = "~ /Fckeditor/"/>
<Add key = "FCKeditor: UserFilesPath" value = "/Files/"/>
</AppSettings>
<ConnectionStrings/>
<System. web>
Description: BasePathIt is the path where fckeditor is located. fckeditor can be written in this way directly under the website directory. If your website has more layers, make appropriate adjustments.
UserFilesPathIs the directory of all uploaded files.Why set to/Files?This is not ~ /FilesFCKeditor uses this value to return the relative path of the uploaded file to the client. Otherwise, the user will retrieve the user's machine directory instead of the http directory during access.
Suggestion: it is better to separate Files into a site under the wwwroot Directory, which is parallel to our site FCKEditor. Don't put it in FCKEditor. Why? Because Files requires the user to have the write permission, it is dangerous to put the Files in FCKEditor.
8. The Files directory must have the write permission. You can set the account based on your website requirements. This document makes it more reasonable to use an ASP. NET account to set the User conveniently.
9. Modify the fckeditor/fckconfig. js file.
At the position of Row 3
Var _ FileBrowserLanguage = 'asp '; // asp | aspx | cfm | lasso | perl | php | py
Var _ QuickUploadLanguage = 'asp '; // asp | aspx | cfm | lasso | php
Change
Var _ FileBrowserLanguage = 'aspx '; // asp | aspx | cfm | lasso | perl | php | py
Var _ QuickUploadLanguage = 'aspx '; // asp | aspx | cfm | lasso | php
10.FCKeditorGive itSlimming. All headers starting with _ are sample files or source files, but we recommend that you be careful.
11. The following example shows how to use the image,
Click Browse server ".
An error is easily reported in the pop-up window.
If the XML request error: internal server error (500) is reported, it is likely that the directory path is incorrect and the write permission is not available.
Select Image
Final Effect
Front-end code:
<% @ Page Language = "C #"Validaterequest = falseAutoEventWireup = "true" CodeFile = "Default. aspx. cs" Inherits = "_ Default" %>
<% @ Register Assembly = "fredck. fckeditorv2" namespace = "fredck. fckeditorv2" tagprefix = "fckeditorv2" %>
<! 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> FCKeditor Text Editor </title>
</Head>
<Body>
<Form id = "form1" runat = "server">
<Div>
<Fckeditorv2: FCKeditor id = "fckeditor1" runat = "server" defaultlanguage = "ZH-CN" Height = "400px" width = "660px"
> </Fckeditorv2: FCKeditor>
</Div>
</Form>
</Body>
</Html>
How to get resultsWhat about it?Fckeditor1.valueYes.
12. There is also a similar control freetextbox which is also very useful. If you are interested, you can find it on the Internet. It is much better than this one, but it doesn't feel better, and its latest version seems to be charged.