Articles → ASP .NET AJAX → Customize Ajax HTML editor in C#

Customize Ajax HTML editor in C#






Why customization of AJAX HTML editor is required?





Objective of This Tutorial





The HTML Editor





Click to Enlarge


Prerequisites































Customization of the Editor









Solution












public class CustomEditor {}




using AjaxControlToolkit.HTMLEditor;
using AjaxControlToolkit.HTMLEditor.ToolbarButton;






public class CustomEditor : Editor{ }






protected override void FillTopToolbar(){}




protected override void FillBottomToolbar(){}




protected override void FillTopToolbar() {
  TopToolbar.Buttons.Add(new Bold());
  TopToolbar.Buttons.Add(new Italic());
  TopToolbar.Buttons.Add(new Underline());
}




protected override void FillBottomToolbar() {
  BottomToolbar.Buttons.Add(new DesignMode());
  BottomToolbar.Buttons.Add(new HtmlMode());
}




using AjaxControlToolkit.HTMLEditor;
using AjaxControlToolkit.HTMLEditor.ToolbarButton;

namespace MyControls {
  public class CustomEditor: Editor {
    protected override void FillTopToolbar() {
      TopToolbar.Buttons.Add(new Bold());
      TopToolbar.Buttons.Add(new Italic());
      TopToolbar.Buttons.Add(new Underline());
    }

    protected override void FillBottomToolbar() {
      BottomToolbar.Buttons.Add(new DesignMode());
      BottomToolbar.Buttons.Add(new HtmlMode());
    }
  }
}





How to use this control in aspx page






<%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="ajax" %>








<ajax:ToolkitScriptManager ID="ScriptManager1" runat="server">
</ajax:ToolkitScriptManager>




<HTMLEditor:CustomEditor ID="editor" runat="server" />





Click to Enlarge


Posted By  -  Karan Gupta
 
Posted On  -  Saturday, May 14, 2011
 
Updated On  -  Tuesday, January 21, 2014

Query/Feedback


Your Email Id  
 
Subject 
 
Query/FeedbackCharacters remaining 250