In this article I will explain with example and attached sample code, how to use and integrate the ASP.Net AJAX Control Toolkit HtmlEditorExtender Rich Text Editor in a website.
Download and Install AJAX Control Toolkit
In order to download and install AJAX Control Toolkit, please refer the following article.
Register AJAX Control Toolkit
You will need to register the AJAX Control Toolkit assembly in order to use the AJAX Control Toolkit’s controls.
You need to place the following line just below the @Page directive.
<%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="asp" %>
HTML Markup
The HTML Markup consists of ToolkitScriptManager, a TextBox, a Button,
a Label and the HtmlEditorExtender control.
You need to set the ID of the TextBox as the TargetControlID for the HtmlEditorExtender control.
<asp:ToolkitScriptManager ID="ToolkitScriptManager1" runat="server">
</asp:ToolkitScriptManager>
<asp:TextBox ID="txtEditor" runat="server" Width="300" Height="200" />
<asp:HtmlEditorExtender ID="HtmlEditorExtender1" runat="server" TargetControlID="txtEditor">
</asp:HtmlEditorExtender>
<br />
<asp:Button Text="Submit" runat="server" OnClick="Submit" />
<br />
<asp:Label ID="lblContents" runat="server" />
Displaying contents of HtmlEditorExtender using Label control in ASP.Net
When the Submit button is clicked, the contents of the AJAX Control Toolkit HtmlEditorExtender Rich TextBox is displayed in the Label control.
C#
protected void Submit(object sender, EventArgs e)
{
lblContents.Text = txtEditor.Text;
}
VB.Net
Protected Sub Submit(sender As Object, e As EventArgs)
lblContents.Text = txtEditor.Text
End Sub
Screenshot
Possible Errors
You might get the following errors. I have already written articles with the help of which you can solve them.
Demo
Downloads