我正在使用 Reportviewer 在我的 .aspx 页面上查看 SSRS 报告。由于此报告查看器在浏览器中呈现为 iframe。每次加载 iframe 时,我都想调用一些 javascript 函数。
I can't use window.onload because the content of reportviewer that is iframes get changed without any postback.
我正在使用 Reportviewer 在我的 .aspx 页面上查看 SSRS 报告。由于此报告查看器在浏览器中呈现为 iframe。每次加载 iframe 时,我都想调用一些 javascript 函数。
I can't use window.onload because the content of reportviewer that is iframes get changed without any postback.
不确定这是否会有所帮助,因为我从未使用过 ReportViewer,但如果您有权访问服务器端页面,请执行以下操作:
protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack)
{
MainIFrame.Attributes.Add("onload", "MainIFrame_OnLoad();");
}
}
在您的 javascript 文件中添加以下内容:
function MainIFrame_OnLoad() {
alert('yes!');
}