Get Help:Ask a Question in our Forums|Report a Bug|More Help Resources
Last post Jul 30, 2012 01:22 PM by Johann87
Aug 18, 2010 08:41 PM|LINK
I've inherited some code that is having a serious problem. On one page, there are several pairs of "Yes"/"No" checkboxes that act like pairs of radio buttons through the use of the ACT MutuallyExclusiveCheckBoxExtender control. They work as expected. However,
when I navigate away from the page, I get a "Microsoft JScript runtime error: Sys.InvalidOperationException: Handler was not added through the Sys.UI.DomEvent.addHandler method." error in the dynamically-generated ScriptResource.ax...c2d9970 [dynamic]
file. The specific method in the dynamically-generated code is:
var $removeHandler = Sys.UI.DomEvent.removeHandler = function Sys$UI$DomEvent$removeHandler(element, eventName, handler)
The element is set to any of the checkbox controls (I've removed them one-by-one and it happens to ALLof them) and the eventName is "Click". I gather from the code that it's trying to do a removeHandler before the addHandler for the particular element has
taken place. True, I don't have any explicit addHandler lines in my code, but I don't any explicit removeHandler lines either. About all I've got in the aspx code is:
The formatting of the code in this message is a bit weird, but it's basically a simple table with three columns. On each row, there's text in the first column, the checkboxes in the second column and a button in the third.
I've searched high and low on the web and nearly every thread I read about his error talks about it in relationship to the use of command buttons in an ACT UpdatePanel.
Any help would be greatly appreciated!
MutuallyExclusiveCheckBoxExtender ToggleButtonExtender addHandler
Aug 19, 2010 03:30 AM|LINK
Please refer this
Aug 19, 2010 06:07 PM|LINK
I checked your link and it boils down to this:
3. After initializeBase(this, [element]);
declare and initialize the eventhandler
this._closeNow = null;
4. inside initialize: function()
before i was using $addHandlers
replaced it with seperate $addHandler for each event like the following
this._closeNow = Function.createDelegate(this, this._onCloseNow);
$addHandler(this._closeImage, "click", this._closeNow);
5. inside dispose: function()
before i was using $clearHandlers(this.get_element()); to clear the events
replaced it with seperate $removeHandler for each event thati added in the initialize function like the following
$removeHandler(this._closeImage, "click", this._closeNow);
this._closeNow = null;
6. clear the cache of the IE and run it and problem solved.
app; it's all C#. The controls that seem to be related to the issues were drag-and-dropped onto the interface and were either standard web controls (the checkboxes) or Ajax Toolkit Controls (the MutuallyExclusiveCheckbBoxExtender). I'm sure that the Ajax Toolkit
Thanks in advance for any helpful replies!
Sep 06, 2011 07:31 AM|LINK
set ScriptMode="Release" for script manager and let me know if it works.
Sep 20, 2011 10:04 AM|LINK
Congratulations, tanajichavan. Su respuesta me salió muy buena y ha solucionado mi problema.
Jul 06, 2012 10:36 AM|LINK
It solved my problem.thanks
Jul 30, 2012 01:22 PM|LINK
Do you have any reference on why this error occurs and it is fixed by changing ScriptMode? It didn't occur to me until we made some changes but I am unable to identify the cause.