遇到一个问题,现在需要在框架页中执行打印,打印按钮在上页,要打印的内容在下页(如图)------------------------------------------------------------------
frame name="top" 打印按钮(button1) print.aspx
------------------------------------------------------------------
frame name="bottom" 打印内容 main.aspx
按钮(button2)
-------------------------------------------------------------------我使用的方法是:在print.aspx上加一个html按钮button1,在button的onclick事件中加入parent.frames["bottom"].focus();
top.frames['bottom'].document.all.button2.click();调用button2的click事件
在main.aspx上加一个服务器按钮
在
private void Button2_Click(object sender, System.EventArgs e)
{
添加打印内容(查询数据库....) Response.Write("<script>alert('ok')</script>");
Response.Write("<script>window.print()</script>");//使用window.print()打印
}***********************************************************************************我的问题是:
Response.Write("<script>alert('ok')</script>");都可以执行弹出"ok"
但是Response.Write("<script>window.print()</script>");一点动静都没有!!!!。
如果我以main.aspx作为起始页的话点击Button2则可以打印,不知道为什么,大家能给个解决方法吗,谢谢!!!!
frame name="top" 打印按钮(button1) print.aspx
------------------------------------------------------------------
frame name="bottom" 打印内容 main.aspx
按钮(button2)
-------------------------------------------------------------------我使用的方法是:在print.aspx上加一个html按钮button1,在button的onclick事件中加入parent.frames["bottom"].focus();
top.frames['bottom'].document.all.button2.click();调用button2的click事件
在main.aspx上加一个服务器按钮
在
private void Button2_Click(object sender, System.EventArgs e)
{
添加打印内容(查询数据库....) Response.Write("<script>alert('ok')</script>");
Response.Write("<script>window.print()</script>");//使用window.print()打印
}***********************************************************************************我的问题是:
Response.Write("<script>alert('ok')</script>");都可以执行弹出"ok"
但是Response.Write("<script>window.print()</script>");一点动静都没有!!!!。
如果我以main.aspx作为起始页的话点击Button2则可以打印,不知道为什么,大家能给个解决方法吗,谢谢!!!!
解决方案 »
- 在表现层使用DetailView的插入数据的时候,输入字符串的格式不正确。
- 请教ashx文件怎么获得请求参数?
- 请问怎么实现asp.net中只打印web窗体中的某一个table中的内容,并且保持table内格式不变?
- 项目的创建 有经验者请进
- 图片服务器与主数据分离的问题
- 请问如何用dropdownlist控件显示asp.net treeview的树状目录
- 有关treeview和listbox在客户端用javascript相互转移值的问题,实在是不懂。
- 欲实现asp.net2.0下的AJAXExtensionsToolbox,如何修改web.config
- asp.net中简单的SQL语句哪里有错?
- 请教:在asp.net应用中如何使用全局变量???
- 为什么选择dropdownlist了后,不post页面?
- 大家讨论,怎么杀死3721!
Page.RegisterStartupScript(s,"<script language='javascript'>window.print();</script>");
是不是后面有重新定向的语句
to:goody9807() 您的方法也不行啊,也不执行打印,而且后面没有重新定向的语句