ASP.NET的框架javascript将不允许我呈现原始HTML IFRAME

时间:2011-07-14 09:19:28

标签: javascript asp.net iframe internet-explorer-6 ascx

我有一个UserControl而不是将标签放入其ascx标记文件中,而是覆盖其代码隐藏中的render()以写出使用XSLT从XML生成的XHTML。

我想渲染一个iframe(作为打败IE6的SELECT z-index错误的技巧)但是当我编辑xslt来呈现iframe时,ASP.NET的ScriptResource.axd输出中会出现javascript错误(但是不在Firefox中):

  

错误:Sys.ArgumentNullException:值不能为null。参数名称:panelsCreated [0]

我在VS2010中调试时指示的行是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();
}

ASP.NET是否存在生成纯HTML IFRAME元素的问题?

2 个答案:

答案 0 :(得分:5)

将脚本管理器的脚本模式更改为仅适用于我的版本

在页面的OnInit方法中,我添加了这一行

ScriptManager.GetCurrent(Page).ScriptMode = ScriptMode.Release;

答案 1 :(得分:0)

我通过在<iframe></iframe>中添加文字来解决问题。如果我的用户使用不支持iframe的浏览器,则该文本将被另一个元素覆盖!