使用javascript进行Iframe高度调整

使用javascript进行Iframe高度调整,javascript,c#-4.0,iframe,height,Javascript,C# 4.0,Iframe,Height,我在aspx页面中有一个iframe: <iframe style="width: 100%;" src="" scrolling="auto" id="reportFrame" runat="server"> </iframe> 在页面加载中: this.reportFrame.Attributes.Add("onload", "adjustMyFrameHeight();");

我在aspx页面中有一个iframe:

<iframe style="width: 100%;" src="" scrolling="auto" id="reportFrame" runat="server">
                                            </iframe>
在页面加载中:

 this.reportFrame.Attributes.Add("onload", "adjustMyFrameHeight();");
我已经在页面加载中指定了脚本,因为我们使用的是runat=“server”,但脚本现在仍在工作。
有什么帮助吗?

在一步一步调试脚本后,我得到了一个答案,为了获得框架的Id,我必须指定整个Id或完整Id,因为它是在母版页的内容占位符中继承的,所以必须给出整个Id

  case "Case1":
                reportFrame.Attributes["src"] = "acd.aspx";
                reportFrame.Attributes["height"] = "355px"; //giving iframe height as script now working.
 this.reportFrame.Attributes.Add("onload", "adjustMyFrameHeight();");