Archive for category HTML Editor

How use html Editor in Asp.Net Ajax – About

Html Editor Description

HTMLEditor is an ASP.NET AJAX Control that allows you to easily create and edit HTML content. Various buttons in toolbar are used for content editing. You can see generated HTML markup and preview document.

Samples

Client-side made HTMLEditor
Custom skin with modified bottom toolbar
Lite top toolbar
Lite top toolbar without bottom toolbar
HTMLEditor without bottom toolbar
HTMLEditor controls inside Tabs control
Full screen expanded

Properties

The control above is initialized with this code. The italic properties are optional:

<%@ Register
    Assembly="AjaxControlToolkit"
    Namespace="AjaxControlToolkit.HTMLEditor"
    TagPrefix="HTMLEditor" %>
...
<HTMLEditor:Editor runat="server"
        Height="300px"
        Width="100%"
        AutoFocus="true"
/>
  • ActiveMode – Active editing panel (Design, Html, Preview) on control loaded
  • AutoFocus – If true, editing panel is focused and cursor is set inside it (”Design” or “HTML text”) on initial load or editing panel change
  • Content – Gets/sets HTML content of HTMLEditor
  • CssClass – A css class override used to define a custom look and feel for the HTMLEditor. See the HTMLEditor Theming section for more details
  • DesignPanelCssPath – Sets the path of additional CSS file used for HTMLEditor’s content rendering in “Design” panel. If not set, the default CSS file is used which is embedded as a WebResource and is a part of the Toolkit assembly
  • DocumentCssPath – Sets the path of CSS file used for HTMLEditor’s content rendering in “Design” and “Preview” panels. If not set, the default CSS file is used which is embedded as a WebResource and is a part of the Toolkit assembly
  • Height – Sets the height of the body of the HTMLEditor
  • HtmlPanelCssClass – A css class override used to define a custom look for the HTMLEditor’s “HTML text” mode panel. See the HTMLEditor Theming section for more details
  • IgnoreTab – If true, Tab key navigation is suppressed inside HTMLEditor control
  • InitialCleanUp – If true, HTMLEditor’s content is cleaned up on initial load. MS Word specific tags are removed
  • NoScript – If true, JavaScript code is suppressed in HTMLEditor’s content
  • NoUnicode – If true, all Unicode characters in HTML content are replaced with &#code;
  • OnClientActiveModeChanged – The client-side script that executes after active mode (editing panel) changed
  • OnClientBeforeActiveModeChanged – The client-side script that executes before active mode (editing panel) changed
  • SuppressTabInDesignMode – If true, no white spaces inserted on Tab key press in Design mode. Default Tab key navigation is processing in this case
  • Width – Sets the width of the body of the HTMLEditor
Theming

You can change the look and feel of HTMLEditor using the HTMLEditor CssClass property. HTMLEditor has a predefined set of CSS classes that can be overridden. It has a default style which is embedded as a WebResource and is a part of the Toolkit assembly that has styles set for all the sub-classes. You can find the default styles in the Toolkit solution in the “AjaxControlToolkit\HTMLEditor\Editor.css” file. If your CssClass does not provide values for any of those then it falls back to the default value. In the example above the default style is used. To customize the same the user would have to set the CssClass property to the name of the CSS style and define the styles for the individual classes so that the various elements in a HTMLEditor control can be styled accordingly. For example if the CssClass property was set to “CustomEditorStyle” this is how the css to style the HTMLEditor top toolbar would look:

.CustomEditorStyle .ajax__htmleditor_editor_toptoolbar {
        background-color:#F0F0F0; padding: 0px 0px 2px 2px;
}

HTMLEditor Css classes

  • .ajax__htmleditor_editor_container: A container element (table) that wraps all of the HTMLEditor.
    Child CSS classes: .ajax__htmleditor_editor_toptoolbar, .ajax__htmleditor_editor_editpanel, .ajax__htmleditor_editor_bottomtoolbar.
  • .ajax__htmleditor_editor_toptoolbar: A container element that wraps all buttons of the top toolbar.
    Child CSS classes: .ajax__htmleditor_toolbar_button, .ajax__htmleditor_toolbar_button_hover.
  • .ajax__htmleditor_editor_editpanel: A container element that wraps editing panel (in any mode).
    Child CSS classes: none.
  • .ajax__htmleditor_editor_bottomtoolbar: A container element that wraps all buttons of the bottom toolbar.
    Child CSS classes: .ajax__htmleditor_toolbar_button, .ajax__htmleditor_toolbar_button_hover.
  • .ajax__htmleditor_toolbar_button: This is applied to a button of toolbar.
    Child CSS classes: none.
  • .ajax__htmleditor_toolbar_button_hover: This is applied to a button of toolbar when the mouse is hovering over.
    Child CSS classes: none.
  • div.ajax__htmleditor_toolbar_button label: This is applied to a <label> element of “selector button” in toolbar (Font, Size).
    Child CSS classes: none.
  • div.ajax__htmleditor_toolbar_button select: This is applied to a <select> element of “selector button” in toolbar.
    Child CSS classes: none.
  • div.ajax__htmleditor_toolbar_button select option: This is applied to <select> element’s options of “selector button” in toolbar.
    Child CSS classes: none.

,

No Comments

Microsoft’s AJAX Control Toolkit Updated, Includes WYSIWYG Editor

ASP.Net AJAX is Microsoft’s free framework for developing rich internet applications (RIA) that work across all browsers. It includes four components: Server-Side ASP.NET AJAX, Client-Side ASP.NET AJAX, the AJAX Control Toolkit and the jQuery library.

The AJAX Control Toolkit that has just been updated with some new functionality. Let’s have a look.

A Framework Overview

Let’s step back and look at the four components of the ASP.NET AJAX framework:

  • Server-Side ASP.NET AJAX: Included as a standard in the .NET framework 3.5, this programming model enables developers to add AJAX functionality to a web application without writing Javascript.
  • Client-Side ASP.NET AJAX: For those who love their Javascript and want to build client-side RIAs, then there’s the Client-Side library. Also included with the .NET framework 3.5, they are currently working on a new version.
  • AJAX Control Toolkit: The AJAX Control Toolkit contains over 30 different controls to use when developing RIAs and you don’t need to know Javascript to use them.
  • jQuery Library: An open source Javascript Library, a standard component of ASP.NET MVC apps.

AJAX Control Toolkit Updates

The AJAX Control Toolkit is an open source project, worked on jointly by Microsoft and the ASP.NET AJAX Community. The toolkit is an infrastructure that helps developers to create extenders and controls that can be reused, customized and extended as needed. It also includes a number of out of the box controls ready and waiting to be implemented.

So what’s new in Version 3.0.30512?

HTMLEditor

A new WYSIWYG HTML Editor that also allows you to view source and preview your content — like most HTML Editors.

AJAX_Htmleditor.jpg
HTMLEditor Control

You can get both a client-side HTML editor and a server side version. In addition you can change the buttons on the top toolbar and remove the bottom toolbar (taking away the ability to view source or preview).

Add the ability to create a custom skin to the editor and insert the editor inside TABS and you’ve got a pretty functional control there.

editor_tabs.jpg
HTMLEditor – tabs

The HTMLEditor was built by a company called Obout.

ComboBox

The ComboBox is the combination of a textbox and the ability to select an option from a dropdown list.

combobox.jpg
ComboBox

It has a number of similar properties, behaviors and naming conventions as the Windows Forms ComboBox. The ComboBox is a supplement to the AutoCompleteExtender. It can bind to data source controls, can restrict input to what is in the list, has both text and value properties and more.

Using the CssClass property you can create a custom theme for the ComboBox.

ColorPicker

The ColorPicker is an extender. It can be added to any textbox to enable users to select a color and get the associated color code. A client-side pop up control opens to show a number of colors to select from.

colorpicker2.jpg
ColorPicker Default

You just click inside the textbox to have the colors UI pop up. You can also add a SampleControl and a Popup Button control, shown below, to make your ColorPicker a bit more functional.

ColorPicker1.jpg
ColorPicker

Theming is not currently supported, but is expected using the CssClass Property. In the meantime you can override a predefined set of CSS classes if you want.

Developing RIAs

The AJAX Control Toolkit is supposed to be cross-browser compliant. These screenshots were taken with FireFox 3, so it does appear to work there. And of course it’s going to work with Internet Explorer.

Both Visual Studio and the free Visual Web Developer Express 2008 support developing AJAX applications, including Intellisense for Javascript and other Javascript libraries like jQuery and application debugging.

You can download the latest version of the AJAX Control Toolkit on CodePlex.

, , , ,

No Comments