How to use the Htmlarea editor in asp.net

Source: Internet
Author: User

Htmlarea is a pure js+html editor, theoretically can be set on any language platform, after the actual use can and ASP.net 2.0 + Ajax very good combination, now this blog system has taken it as an article editor, the following is the specific installation steps.

First download the HtmlArea3.0 and unzip to a directory in the Web project.

Lang/gb.js is a Chinese language file, the official default is ANSI code, if your Web.config set to Utf-8 (default), you need to open the Gb.js Notepad, save as a utf-8 format.

The following is a reference fragment:
<scripttype= "Text/javascript" >_editor_url= ". /htmlarea/"; _editor_lang=" GB ";</script>
<scripttype= "Text/javascript" src= ". /htmlarea/htmlarea.js "></script>
<asp:textboxid= "Htmlarea" cssclass= "Htmlarea" runat= "Server" height= "200px" textmode= "MultiLine" width= "100%" ></asp:TextBox>
The following is a reference fragment:
Protectedvoidpage_load (OBJECTSENDER,EVENTARGSE) {
if (! Page.IsPostBack) {
Stringbuildersb=newstringbuilder ();
Sb. Append ("vareditor=null;");
Sb. Append ("Functioniniteditor () {");
Sb. Append ("Editor=newhtmlarea" +articlebody1.findcontrol ("Htmlarea"). Clientid+ "");
Sb. Append ("Editor.generate ();}"); Sb. Append ("document.body.onload=initeditor;");
Scriptmanager.registerstartupscript (this. Page,this. GetType (), "Htmlareascript", sb. ToString (), true);
}

If UpdatePanel commits, you must also reinitialize the editor by executing the following statement after submission:

The following is a reference fragment:
Scriptmanager.registerstartupscript (this. Page,this. GetType (), "Htmlareascript", "Initeditor ();", true);

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.