1

Resources: WebForm, VS 2010, .Net 4.0, SQL Server 2008 R2, IE 11 & Chrome 36.0.1985.125 m.

The web form is meant to create email notifications. Therefore, I have a textbox with an ajax HtmlEditorExtender attached to it. After the user adds/edits the html text, that is supposed to be the email body, it is saved in a varbinary(max) column in the db.

Debug

In debug mode, I noticed that when the user clicks the save button on the form, I get a JS error (although I don't have any js script in the form at all!) :

JS Error in Debug

This error comes from the HTMLEditorExtender as when I remove this control, I no longer get any errors on the page when I submit the form. Pressing Continue, in debug, I don't get any other unexpected behavior and the text is saved in the db in the proper html format.

Production

When the site is published, I get this kind of weird behavior (user enters the following text): ProdEnteredText Before Submit

After I click Save the first time: After I click save the first time

After I click save several times w/o changing anything to the text: enter image description here

This happens ONLY in IE (tested in IE 11, I don't know if it is the same in previous versions of IE). In Google Chrome it works ok, but in my company the only allowed browser is IE so Chrome won't do me any good here.

Here are some code snippets:

Aspx:

  • control:

    <td colspan="10" style="padding: 5px; margin: 5px; width:100%; overflow:auto;" >
    <asp:TextBox ID="tbBody" runat="server" Text="" TextMode="MultiLine" Rows="30" Columns="118" ></asp:TextBox>
    <br />
    <ajaxToolkit:HtmlEditorExtender ID="htmlEditorExtender1" runat="server"
        TargetControlID="tbBody" DisplaySourceTab="true"  >
        <Toolbar> 
            <ajaxToolkit:FontNameSelector />
            <ajaxToolkit:HorizontalSeparator />
            <ajaxToolkit:FontSizeSelector />
            <ajaxToolkit:Bold />
            <ajaxToolkit:Italic />
            <ajaxToolkit:Underline />
            <ajaxToolkit:StrikeThrough />                                                    
            <ajaxToolkit:JustifyLeft />
            <ajaxToolkit:JustifyCenter />
            <ajaxToolkit:JustifyRight />
            <ajaxToolkit:JustifyFull />
            <ajaxToolkit:InsertOrderedList />
            <ajaxToolkit:InsertUnorderedList />
            <ajaxToolkit:RemoveFormat />                                                    
            <ajaxToolkit:BackgroundColorSelector />
            <ajaxToolkit:ForeColorSelector />                                                    
            <ajaxToolkit:Indent />
            <ajaxToolkit:Outdent />
            <ajaxToolkit:InsertHorizontalRule />
            <ajaxToolkit:HorizontalSeparator />                                                    
        </Toolbar>
    </ajaxToolkit:HtmlEditorExtender>
    

  • page:

    Page Language="C#" AutoEventWireup="false" CodeFile="Notification.aspx.cs" Inherits="RulesManagement_Notification" Title="Notification" MasterPageFile="~/MasterPage.master" ValidateRequest="false"

    Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="ajaxToolkit"

CS:

  • save method (when passing the text as a parameter into the db):

    SqlParameter prmBody = new SqlParameter("@BODY", SqlDbType.NVarChar, -1); prmBody.Value = tbBody.Text; sqlSaveNotif.Parameters.Add(prmBody);

From what I can tell the actual text of the textbox it's being changed by some sort of weird behavior of this HTMLEE but only in IE. I am open to using any other control out there that will give me the same functionality as this HTMLEE. I've tried the FreeTextBox control but I can't make it work in IE, it only works in Chrome :). Is there any out of the box (html or asp.net) control that would help me in this case? If not, how can I make the Ajax's HTMLee control to work correctly in IE?

Sergiu
  • 432
  • 6
  • 18
  • I've had no problems with the FreeTextBox control in an IE only corporate environment. I have no problems with the Extender either. I presume you have the jquery library referenced? What happens if you remove the reference to the jquery library and try to run it? Does anyone know of a good, commercial, html text box - I'm quite happy to pay but I want it supported. I think FreeTextBox is no longer supported. I used to use a Dart control but that is no longer supported. – Martin Smellworse Jul 23 '14 at 08:39
  • Hey Martin, yes, I do have a reference in the master page (which is in VB as opposed to my page which is in C#) to the jquery library - jquery-1.6.4.min.js . I will remove the reference and see what happens. – Sergiu Jul 23 '14 at 09:00
  • Nope, can't remove it as it is being used in the master page form and in my page I also use other ajax components such as the ValidatorCalloutExtender.. any other thoughts please? – Sergiu Jul 23 '14 at 09:03
  • I think I found what the problem was! :) I changed from the control's definition the `DisplaySourceTab="true"` to `DisplaySourceTab="false"` , meaning that I will no longer be able to switch to view the actual HTML code in the control. After setting it to false, I no longer encounter this error in IE 11. I will test it a bit more, but as far as I tested it, it didn't add the weird jquery string in the textbox's text. – Sergiu Jul 23 '14 at 09:15
  • Nope, spoke too soon.. After changing the displaysourcetab to false it does the same thing... Damn it! I was hoping to get past this stupid error! – Sergiu Jul 23 '14 at 09:19
  • 1
    Now for sure I've found the solution! It was because the master page was set to run in compatibility with IE8 and this ajax control must have been created based on a newer version of IE. Therefore, changing the master page compatibility to IE10 fixed all my problems, in both debug and production! Old version in which I got all those errors: <%----%> The new comp level that fixed everything in both debug and production: – Sergiu Jul 23 '14 at 09:36
  • 1
    Perhaps I should thank @ccStars for giving me the idea in this post: http://stackoverflow.com/questions/24203119/postback-with-html-editor-extender-on-page-causes-javascript-error-in-ie11 – Sergiu Jul 23 '14 at 09:38

0 Answers0