To see how to implement client side onchange event on HtmlEditorExtender
please click on this link:
Samples
The HtmlEditorExtender is an ASP.NET AJAX Control that enables you to extend the
standard ASP.NET TextBox control with support for rich formatting. For example,
the HtmlEditorExtender enables users to apply bold, italic, underline, subscript,
superscript, and different foreground and background color to text.
The HtmlEditorExtender
control is very lightweight and takes advantage of HTML5. The new HtmlEditorExtender
is compatible with IE6 and newer, and the latest versions of Mozilla Firefox, Google
Chrome, and Apple Safari.
Furthermore, you can easily customize the
toolbar buttons displayed by the HtmlEditorExtender. For example, you can customize
the HtmlEditorExtender so that it displays only bold and italic buttons and no other
buttons. Same way you can display Add image button and take the advantage to upload
and insert images from the HtmlEditorExtender.
The HtmlEditorExtender is initialized with this code. The italic properties
are optional:
<ajaxToolkit:HtmlEditorExtender ID="HtmlEditorExtender1"
TargetControlID="TextBox1" DisplaySourceTab="true"
runat="server"/>
<Toolbar>
<ajaxToolkit:Undo />
<ajaxToolkit:Redo />
<ajaxToolkit:Bold />
<ajaxToolkit:Italic />
<ajaxToolkit:Underline />
<ajaxToolkit:StrikeThrough />
<ajaxToolkit:Subscript />
<ajaxToolkit:Superscript />
<ajaxToolkit:JustifyLeft />
<ajaxToolkit:JustifyCenter />
<ajaxToolkit:JustifyRight />
<ajaxToolkit:JustifyFull />
<ajaxToolkit:InsertOrderedList />
<ajaxToolkit:InsertUnorderedList />
<ajaxToolkit:CreateLink />
<ajaxToolkit:UnLink />
<ajaxToolkit:RemoveFormat />
<ajaxToolkit:SelectAll />
<ajaxToolkit:UnSelect />
<ajaxToolkit:Delete />
<ajaxToolkit:Cut />
<ajaxToolkit:Copy />
<ajaxToolkit:Paste />
<ajaxToolkit:BackgroundColorSelector />
<ajaxToolkit:ForeColorSelector />
<ajaxToolkit:FontNameSelector />
<ajaxToolkit:FontSizeSelector />
<ajaxToolkit:Indent />
<ajaxToolkit:Outdent />
<ajaxToolkit:InsertHorizontalRule />
<ajaxToolkit:HorizontalSeparator />
<ajaxToolkit:InsertImage />
</Toolbar>
</ajaxToolkit:HtmlEditorExtender>
Events
- ImageUploadComplete - Raised on the server when an image is uploaded
successfully. In this event an instance of AjaxFileUploadEventArgs is passed in the
argument that contains file name, size and content type.
Properties
- TargetControlId - ID of textbox to extend with htmlEditor.
- Toolbar - This provides facility to customize toolbar as per requirement.
This tag is optional and if user does not provide toolbar tag then by default all
buttons will be populated in the toolbar. User must add at least 1 button in the
toolbar tag.
- SanitizerProvider - Returns the Sanitizer Provider or null when no
Sanitizer Provider is configured.
- DisplaySourceTab - Whether to display source tab to switch to
Source view to see html contents.
We strongly recommend that you do not use the HtmlEditorExtender on a public website
without using the AntiXSS Sanitizer Provider. If you do not use the AntiXss Sanitizer
Provider then your website will be open to Cross-Site Scripting (XSS) Attacks.
The AntiXSS Sanitizer Provider is included in the SanitizerProviders folder with the
CodePlex release of the Ajax Control Toolkit. You need to add a reference to all three
assemblies contained in the folder: SanitizerProviders.dll, AntiXSSLibrary.dll, and
HtmlSanitizationLibrary.dll.
You must add the following configuration sections to your Web.config file to enable the
provider:
<configuration>
<configSections>
<sectionGroup name="system.web">
<section name="sanitizer"
requirePermission="false"
type="AjaxControlToolkit.Sanitizer.ProviderSanitizerSection,
AjaxControlToolkit"/>
</sectionGroup>
</configSections>
<system.web>
<compilation targetFramework="4.0" debug="true"/>
<sanitizer defaultProvider="AntiXssSanitizerProvider">
<providers>
<add name="AntiXssSanitizerProvider"
type="AjaxControlToolkit.Sanitizer.
AntiXssSanitizerProvider"></add>
</providers>
</sanitizer>
</system.web>
</configuration>
The AjaxControlToolkitSampleSite is configured to use the AntiXss Sanitizer Provider.