Wednesday, April 16, 2014

RadioButton won't postback when using AjaxControlToolkit HTMLTextEditor in IE11

There is a bug in the AjaxControlToolkit HTMLTextEditor that prevents a radio button group from posting back. This may involve other controls too, i don't know, i only tested the radio button group since that's what i needed. It only seems to happen in IE11 also. I tested it in Firefox and Chrome and it works fine.

I spent several hours debugging this, because i thought it was a problem in my code. So then i decided to isolate this as much as possible by adding an HTMLTextEditor to a form with just a radio button group and a label. When the selected item in the radio button group changes it sets the Label to the selected item's text.

For example: If i select Hidden, Label should say Hidden too.


The HTMLTextEditor + radio lable

Radio Button Group event that updates the label

The ASP.NET markup 


Then i fired up the IE debugger (F12), and selected a different item trying to invoke the OnSelectedIndexChanged event. An error was caught by the IE11 debugger





The error

Solution
this._editableDiv.firstChild is null. I googled quite a bit, and found out that if you run into this a workaround is to set THREE BLANK SPACES in the textbox. That makes it so the firstChild field is not null.

In other words, set the text of the HTMLTextEditor to "   ". I found that this worked. However, I didn't want to deal with a broken third party tool, so I replaced it with CKEditor instead.

No comments:

Post a Comment

There was an error in this gadget