我该如何检查页面是否已经加载完毕?当它加载完毕后,如何执行在C#代码中为该页面创建的方法?
我想要按照以下事件顺序进行操作:
- 页面加载完毕
- 下载页面中的GridView表格为Excel文件
- 调用方法
download()
- 关闭浏览器
我应该如何完成这些操作呢?
这个链接回答了你的问题吗?
使用示例(在您的C#代码中)
protected void Page_Load(object sender, EventArgs e)
{
Page.LoadComplete +=new EventHandler(Page_LoadComplete);
}
void Page_LoadComplete(object sender, EventArgs e)
{
// call your download function
}
$(document).ready(function() {
// do window.location or another one of the options to download the file.
});
你可以在DOM JavaScript中完成它:
window.onload = function() {
download()
}