I have an intermittent problem that I think is related to use of the Ajax Control Toolkit. Incidentally this is a non-public website running on ASP.NET 4.0 which is only required to support IE10+ browsers.
I have a fairly simple page containing one GridView linked to an ObjectDataSource with Select and FilterParameters. There is also an ImageButton with an ID of AddButton with an attached ModalPopupExtender as follows:
<ajaxToolkit:ModalPopupExtender ID="MPE" runat="server" TargetControlID="AddButton" PopupControlID="AddPanel" BackgroundCssClass="modalBackground" DropShadow="true" OkControlID="CloseButton" OnOkScript="javascript:void window.location.assign('polform.aspx');" CancelControlID="CancelButton" />
<asp:Panel ID="AddPanel" runat="server" style="display:none" ><iframe id="AddFrame" runat="server" width="717" height="370" style="background:transparent;border:none;margin:0;padding:0;" /></asp:Panel><div style="display:none"><asp:Button ID="CloseButton" ClientIDMode="Static" runat="server"/><asp:Button ID="CancelButton" ClientIDMode="Static" runat="server"/></div>
I set the src of the iframe in code behind on Page.Load as follows (the url can only be determined programmatically):
If Not IsPostBack Then If Roles.IsUserInRole("Editor") Then AddFrame.Attributes("src") = "addpol.aspx?id=" & ..... AddButton.Visible = True Else AddButton.Visible = False End If End If
The modal popup itself works fine when the button is clicked. But even when the button is not clicked, I get an intermittent fatal Javascript error in the parent page when there is a seemingly unrelated postback - such as an AutoPostBack on a TextBox used for a filter, paging on the GridView or even a simple link to a separate page. But 9 times out of 10 (not a precise measure!) there is no error and everything is fine. The error has not so far occurred when the initialisation code on Page.Load is not run, so I assume that it must in some way be related to setting the iframe src, but I cannot see why this code would itself involve Javascript without the button even being clicked.
The Javascript error as reported by VS2012 is something like 'Array' is undefined, but I have no idea what this is referring to. I suspect that it may be a timing issue related to scripts not being loaded or something, but I do not know how to go about investigating this.
I am several versions behind the latest version of the Toolkit (I have so far tested with the January 2013 release 7.0123 and the June 2013 release 7.0607), but I have not found any reported workitems which appear to relate to my problem so am reluctant to upgrade to a newer version unless I am confident that this is a known issue that has been resolved. Has anyone else experienced anything similar or have any suggestions as to how best to investigate such an issue? Is there a better way/place/time to initialise the iframe or otherwise ensure that all dependencies are fully loaded?
Jon