Technical discussions about .NET and J2SE Concepts

HTMLEditorExtender Control in ASP.NET

Hi Friends. Greetings to everyone!!!!

Image

When I was in my client’s place, I was having problems when adding HTMLEditorExtender control. That’s why I am posting the solution with successful one after trying number of times.

  • Download the file AjaxControlToolkit.Binary.NET4 from Internet. You can dowload from http://ajaxcontroltoolkit.codeplex.com/releases/view/43475
  • Remove the previously added AjaxControlToolkit.dll from the references of your asp.net web application if exists.
  • Then add the reference of the downloaded AjaxControlToolkit.dll and the following dll’s under SanitizerProviders folder: SanitizerProviders.dll, HtmlAgilityPack.dll.
  • Wherever you want the HTMLEditorExtender add the following lines of code in your *.aspx page:

Add the following  below your page directive <%@Page..%> tag:

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

Add the following wherever you want the HTMLEditorExtender on your aspx page:

<asp:TextBox runat=”server” ID=”TextBoxCommitment” TextMode=”MultiLine” Columns=”50″ Rows=”10″ Width=”98%” BackColor=”White”/>
<ajax:HtmlEditorExtender ID=”HtmlEditorExtender1″ TargetControlID=”TextBoxCommitment” DisplaySourceTab=”true” runat=”server”>
<Toolbar>
<ajax:Undo />
<ajax:Redo />
<ajax:Bold />
<ajax:Italic />
<ajax:Underline />
<ajax:StrikeThrough />
<ajax:Subscript />
<ajax:Superscript />
<ajax:JustifyLeft />
<ajax:JustifyCenter />
<ajax:JustifyRight />
<ajax:JustifyFull />
<ajax:InsertOrderedList />
<ajax:InsertUnorderedList />
<ajax:CreateLink />
<ajax:UnLink />
<ajax:RemoveFormat />
<ajax:SelectAll />
<ajax:UnSelect />
<ajax:Delete />
<ajax:Cut />
<ajax:Copy />
<ajax:Paste />
<ajax:BackgroundColorSelector />
<ajax:ForeColorSelector />
<ajax:FontNameSelector />
<ajax:FontSizeSelector />
<ajax:Indent />
<ajax:Outdent />
<ajax:InsertHorizontalRule />
<ajax:HorizontalSeparator />
<ajax:InsertImage />
</Toolbar>
</ajax:HtmlEditorExtender>

  • Open your web.config file and do the following guidelines:

Add the following code below your <configuration> starting tag:

<configSections>
<sectionGroup name=”system.web”>
<section name=”sanitizer”
requirePermission=”false”          type=”AjaxControlToolkit.Sanitizer.ProviderSanitizerSection,AjaxControlToolkit”/>
</sectionGroup>
</configSections>

Add the following code under the <system.web>starting tag and </compilation> ending tag:

<sanitizer defaultProvider=”HtmlAgilityPackSanitizerProvider”>
<providers>
<add name=”HtmlAgilityPackSanitizerProvider” type=”AjaxControlToolkit.Sanitizer.HtmlAgilityPackSanitizerProvider” />
</providers>
</sanitizer>

  • Build your application and run. The HTMLEditorExtender Control will be displayed on your web application.

Thank You!!! Your valuable comments would be really appreciated….

Advertisements

8 responses

  1. Nice Tutorial Sir…
    I have been searching this HTMLEditorExtender for so long time. Now its working fine…Thank You so much…Please keep on sending the posts like this.

    Sandeep Kumar Rath
    .NET Corporate Consultant

    May 30, 2013 at 10:42 am

    • Moinuddin

      onfiguration Error

      Description: An error occurred during the processing of a configuration file required to service this request. Please review the specific error details below and modify your configuration file appropriately.

      Parser Error Message: Could not load file or assembly ‘AjaxControlToolkit, Version=4.1.7.123, Culture=neutral, PublicKeyToken=28f01b0e84b6d53e’ or one of its dependencies. The located assembly’s manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040)

      Source Error:

      Line 58:
      Line 59:
      Line 60:
      Line 61:
      Line 62:

      Source File: D:\D-8 Documents\Projectdevelopingsite\Developing8\Developing8\web.config Line: 60

      Assembly Load Trace: The following information can be helpful to determine why the assembly ‘AjaxControlToolkit, Version=4.1.7.123, Culture=neutral, PublicKeyToken=28f01b0e84b6d53e’ could not be loaded.

      === Pre-bind state information ===
      LOG: User = SHEIKH-PC\sheikh
      LOG: DisplayName = AjaxControlToolkit, Version=4.1.7.123, Culture=neutral, PublicKeyToken=28f01b0e84b6d53e
      (Fully-specified)
      LOG: Appbase = file:///D:/D-8 Documents/Projectdevelopingsite/Developing8/Developing8/
      LOG: Initial PrivatePath = D:\D-8 Documents\Projectdevelopingsite\Developing8\Developing8\bin
      Calling assembly : SanitizerProviders, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null.
      ===
      LOG: This bind starts in default load context.
      LOG: Using application configuration file: D:\D-8 Documents\Projectdevelopingsite\Developing8\Developing8\web.config
      LOG: Using host configuration file:
      LOG: Using machine configuration file from C:\Windows\Microsoft.NET\Framework\v4.0.30319\config\machine.config.
      LOG: Post-policy reference: AjaxControlToolkit, Version=4.1.7.123, Culture=neutral, PublicKeyToken=28f01b0e84b6d53e
      LOG: Attempting download of new URL file:///C:/Windows/Microsoft.NET/Framework/v4.0.30319/Temporary ASP.NET Files/root/16e38f32/9daf1652/AjaxControlToolkit.DLL.
      LOG: Attempting download of new URL file:///C:/Windows/Microsoft.NET/Framework/v4.0.30319/Temporary ASP.NET Files/root/16e38f32/9daf1652/AjaxControlToolkit/AjaxControlToolkit.DLL.
      LOG: Attempting download of new URL file:///D:/D-8 Documents/Projectdevelopingsite/Developing8/Developing8/bin/AjaxControlToolkit.DLL.
      WRN: Comparing the assembly name resulted in the mismatch: Revision Number
      ERR: Failed to complete setup of assembly (hr = 0x80131040). Probing terminated.

      Version Information: Microsoft .NET Framework Version:4.0.30319; ASP.NET Version:4.0.30319.1

      Still I am getting this error, what shall i do.

      December 24, 2013 at 12:45 pm

      • Sorry for the delayed reply moinuddin… That error is because you have an older version of AJAX Control Toolkit. To resolve this,

        1. Goto the physical location of your project
        2. Find out the bin folder.
        3. Delete the AjaxControlToolkit.dll
        4. Download the AJAXControlToolkit from the site I have given http://ajaxcontroltoolkit.codeplex.com/releases/view/43475
        5. Right Click your project on the solution explorer, Add Reference of the downloaded AjaxControlToolkit.dll and the following dll’s under SanitizerProviders folder: SanitizerProviders.dll, HtmlAgilityPack.dll (Which will be available in your downloaded file).

        Thats It!!! You have done……Just Run Your Program It wont throw that error. Once you have tried and come with the solution, please leave me the reply.

        Thanks
        Jeyakumar .K

        January 4, 2014 at 1:46 am

  2. sadhanantham

    Sir Super …..

    June 12, 2013 at 5:46 pm

  3. Gowtam

    Useful Post on HTMLEditorExtender Control….

    June 13, 2013 at 3:46 pm

  4. Vengatesh NE

    Its really good article. As per the instructions I have tried, its working. Thank You

    June 24, 2013 at 5:46 am

  5. Saravanan

    good.

    July 24, 2013 at 11:01 am

  6. Suresh.K

    Very Nice Useful Information. Thanks.

    July 28, 2013 at 2:34 pm

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s