Search code examples
javascriptasp.netiframeinternet-explorer-6ascx

ASP.NET's framework javascript won't let me render a raw HTML IFRAME


I have a UserControl which rather than putting tags into its ascx markup file, overrides render() in its codebehind to write out XHTML generated from XML using XSLT.

I want to render out an iframe (as a trick to defeat IE6's SELECT z-index bug) but as soon as I edit the xslt to render an iframe, a javascript error occurs in ASP.NET's ScriptResource.axd output (but not in Firefox):

Error: Sys.ArgumentNullException: Value cannot be null. Parameter name: panelsCreated[0]

The line indicated when I debug in VS2010 is if (e) throw e;

$type = Sys.WebForms.PageLoadedEventArgs = function PageLoadedEventArgs(panelsUpdated, panelsCreated, dataItems) {
    /// <summary locid="M:J#Sys.WebForms.PageLoadedEventArgs.#ctor">The arguments for the PageRequestManager's pageLoaded event. The pageLoaded event is raised after the DOM has been updated.</summary>
    /// <param name="panelsUpdated" type="Array">An array of UpdatePanels that were updated.</param>
    /// <param name="panelsCreated" type="Array">An array of UpdatePanels that were created.</param>
    /// <param name="dataItems" type="Object" mayBeNull="true"></param>

    var e = Function._validateParams(arguments, [
        {name: "panelsUpdated", type: Array},
        {name: "panelsCreated", type: Array},
        {name: "dataItems", type: Object, mayBeNull: true}
    ]);

    if (e) throw e;

    Sys.WebForms.PageLoadedEventArgs.initializeBase(this);
    this._panelsUpdated = panelsUpdated;
    this._panelsCreated = panelsCreated;
    this._dataItems = dataItems || new Object();
}

Does ASP.NET have issues with generating plain HTML IFRAME elements?


Solution

  • I fixed the problem by adding text inside the <iframe></iframe>. This text will be covered by another element if I ever have a user using a browser that doesn't support iframes!