Configure and use fckedit in ASP. NET

Source: Internet
Author: User
Tags net command
I. configuration method
FCKeditor is applied in ASP. net, need two things, one is FCKeditor itself can enter the official website to download http://ckeditor.com/(FCKeditor has been renamed), the other is used for ASP.. Net FCKeditor Control is fredck. fckeditorv2.dll (Version 1.1 and 2.0 are used here ).
1. Reference fredck. fckeditorv2.dll to the website project.
Decompress the FCKeditor editor and get the FCKeditor folder. Copy the folder to the project of the Web application (the root directory can also make sub-directories such as/Editor/FCKeditor ).

2. There are two ways to use FCKeditor on the page
.
(1) manual encoding
Add ASP to the page. net command:
<% @ register namespace = "fredck. fckeditorv2 "assembly =" fredck. fckeditorv2 "tagprefix =" fckeditorv2 "%>
Add the FCKeditor Control as needed:

(2) integrated into Visual Studio toolbox
open an ASP.. NET page, expand the toolbar, right-click the menu, and select "select item... ", in the displayed" select toolbox items "dialog box". on the "Net Framework components" tab, select "Browse", find and select the FCKeditor Program set, and click" OK.
in this case, a control named FCKeditor is displayed in toolbox, which can be used like a built-in control of Visual Studio.

3. Configure the path of the FCKeditor editor.
The FCKeditor Control is used on the page. You need to know the path of the FCKeditor file group. There are two configuration methods.
(1) Configure web. config
Add
<Add key = "FCKeditor: basepath" value = "~ /Editors/FCKeditor/"/>
After this configuration method is used, you do not need to configure its basepath attribute for the FCKeditor Control used on any page of the project.
(2) directly configure the FCKeditor Control used
On the pageCodeSet the attribute basepath of FCKeditor to the path of the FCKeditor file group, or set its basepath value in the page_init event processor.

4. Configure the FCKeditor File Upload path
In the appsettings configuration section of Web. config, add
<Add key = "FCKeditor: userfilespath" value = "~ /Files/"/>

Ii. Configure FCKeditor
According to the default configuration of FCKeditor, you can complete some common HTML visual editing tasks. However, further configuration is required in actual applications. The FCKeditor Control has few configurable attributes and can only act on one single instance after configuration. In fact, you need to configure the common configuration file/fckconfig in the FCKeditor file group. JS and ASP.. Net private file upload management code file/Editor/filemanager/connectors/aspx/config. configure ascx.

1. Configure the control language
FCKeditor automatically detects the language encoding used by the browser. The default language is English. Modify the configuration line "fckconfig. defaultlanguage = 'en';" to 'zh-cn'. use Chinese as the default language.

2. Configure the Control Application Technology
FCKeditor is used for PHP by default. Modify the configuration line "VaR _ filebrowserlanguage = 'php';" and "VaR _ quickuploadlanguage = 'php';" to 'ASP', using ASP. NET technology.

3. Configure the tab key
The default Tab key is unavailable in FCKeditor. You can modify the configuration line "fckconfig. tabspaces = 0;" to 1, and enable the tab key.

4. Customize the FCKeditor Toolbar
Fckconfig provides two toolbar configurations. In the configuration line "fckconfig. toolbarsets [" default "] = [...];", the configuration of all available buttons is defined (as the default configuration of the toolbar ). In the configuration line "fckconfig. toolbarsets [" Basic "] = [...];", the toolbar configuration of a simplified button is defined. In actual use, there are too many configuration buttons by default, and there are too few simplified configuration buttons. Therefore, you need to customize the toolbar.
Configuration value [...] in the format of [[V, V2 ,.., VN], '/', [...],...] (VN indicates the name of the button to be displayed, '/' indicates the next row of the subsequent button group. If you do not need a button for the entire group, delete the group (in the form of [,...]). If you only do not need a button in the group, delete the button.
Multiple toolbar configurations can be used flexibly in different locations on the website. You can use a relatively simplified toolbar on the common user interface, and a more complex and functional toolbar can be used in the background of the website administrator. The call method is very simple. You only need to execute this. fckedit. toolbarset = "[toolbar name]" during page loading.

5. Customize available text Fonts
FCKeditor is made by foreigners. The default font is also a Spanish font. Modify the configuration line "fckconfig. fontnames = '...';" and add the names of Chinese characters to be used, such as, and _ gb2312.
By default, fckconfig uses the HTML font keyword to indicate the optional font size, which leads to inconsistent display effects in different browsers. Therefore, we recommend that you modify the configuration line "fckconfig. fontsizes = '...';" to remove the font keyword value and add the pixel value or pound value. (Of course, if the global style sheet is defined on the webpage, you do not need to modify this setting, but you should teach the end user how to set the font to achieve the best display effect .)

6. Enable File Upload
FCKeditor provides powerful and easy-to-use File Upload functions, but the file upload function is not available in the default configuration, which is based on security considerations. However, I think that access security control should be implemented by programs rather than controls.
In the config. ascx file, modify the value of checkauthentication () to true. If you want to upload a file with multiple extensions, set the value of forcesingleextension in setconfig () to false. FCKeditor can upload files, images, Flash files, and multimedia files by default () modify allowedtypes to increase or decrease the allowed types (this type can be defined in typeconfig ["typename"]. For example, in the allowedextensions attribute, you can customize the file extension allowed by this type, customize the file extension that is not allowed in deniedextensions ).
In the fckconfig. js file, modify the configuration line "fckconfig. linkbrowserurl = fckconfig. basepath + 'filemanager/Browser/default/browser.html? Connector = '+ encodeuricomponent (fckconfig. basepath + 'filemanager/ORS ors/'+ _ filebrowserlanguage +'/connector. '+ _ filebrowserextension); "is fckconfig. linkbrowserurl = fckconfig. basepath + 'filemanager/Browser/default/browser.html? Type = file & connector = '+ encodeuricomponent (fckconfig. basepath + 'filemanager/ORS ors/'+ _ filebrowserlanguage +'/connector. '+ _ filebrowserextension); "; modify the configuration line" fckconfig. linkuploadurl = fckconfig. basepath + 'filemanager/connectors/'+ _ quickuploadlanguage +'/upload. '+ _ quickuploadextension; "is" fckconfig. linkuploadurl = fckconfig. basepath + 'filemanager/ORS ors/'+ _ quickuploadlanguage +' /Upload. '+ _ quickuploadextension + '? Type = FILE ';". (In this configuration file, it seems that type = file is used as the default parameter, but if this parameter is not added, an error will occur .)

7. Other configurations
For the configuration attributes in these two configuration files, you can easily know the meaning of the two configuration files from the name, which can be basically customized. Note that the format of the attribute value must be correct.

3. Set the FCKeditor file to ASP. NET.
The FCKeditor file group contains files for various application technologies supported by the FCKeditor. Therefore, many files are not required for ASP. NET applications.

In the root directory, only the folder editor is retained. The files fckconfig. JS, FCKeditor. JS, fckpackager. XML, fckstyles. XML, and fcktemplates. XML are retained.
Only the folder aspx is retained under the subdirectory Editor, filemanager, and connectors.

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.