• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 6088
  • Last Modified:

Microsoft JScript runtime error :Sys.InvalidOperationException: Handler was not added through the Sys.UI.DomEvent.addHandler method.

Hi ,

I am developing a .NET application and testing in IE7.
I have used a Tab Container and built Controls inside each tab panel.
I have also used ModalPopupExtender to show popups.
When I am trying to change tabs and when I close the window, I am getting the following error :
Microsoft JScript runtime error :Sys.InvalidOperationException: Handler was not added through the Sys.UI.DomEvent.addHandler method.
Not sure what the problem is ..
Can anyone help in this regards .

Thanks !
0
Srinivas_Vengala
Asked:
Srinivas_Vengala
  • 3
1 Solution
 
CSecurityCommented:
We too were having this same problem.  I have finally found a workaround.  The issue is caused when the Ok and/or Cancel Buttons of the ModalPopupExtender are defined within the UpdatePanel of the Panel that is popped up.  To fix the problem with the code provided, do the following:

 Change this line:

<ajax:ModalPopupExtender ID="ModalPopupExtender" runat="server" TargetControlID="InvisButton" PopupControlID="ResourceGalleryPanel" BackgroundCssClass="GalleryBackground" DropShadow="true" OkControlID="FinishButton" CancelControlID="CancelButton" />

To:

<ajax:ModalPopupExtender ID="ModalPopupExtender" runat="server" TargetControlID="InvisButton" PopupControlID="ResourceGalleryPanel" BackgroundCssClass="GalleryBackground" DropShadow="true" OkControlID="btnMFinish" CancelControlID="btnMClose" />

<asp:Button ID="btnMClose" runat="server" Style="visibility: hidden" />

<asp:Button ID="btnMFinish" runat="server" Style="visibility: hidden" />

 

This issue seems to stem from the fact that the ModalPopupExtender is not expecting to have the Ok and Cancel controls in the update panel.  Normally, you cannot define and Code Behind for these Buttons click events.  So when you Click on these buttons, and they post back to the server, something is broken between the ModalPopupExtender and the buttons.  By defining dummy buttons to take their place, it will make the web page stop throwing the javascript exception.  Even though the buttons are invisible, and do not do anything.


from:
http://forums.asp.net/t/1055781.aspx
0
 
CSecurityCommented:
0
 
CSecurityCommented:
1) Debug script causes errors
2) The live websites are using debug scripts (not release) despite webcongig debug = false

http://ajaxcontroltoolkit.codeplex.com/WorkItem/View.aspx?WorkItemId=17952
0

Featured Post

Veeam and MySQL: How to Perform Backup & Recovery

MySQL and the MariaDB variant are among the most used databases in Linux environments, and many critical applications support their data on them. Watch this recorded webinar to find out how Veeam Backup & Replication allows you to get consistent backups of MySQL databases.

  • 3
Tackle projects and never again get stuck behind a technical roadblock.
Join Now