打印控件与重定向

ScriptManager.RegisterStartupScript(print_btn, this.GetType(), "sd", " PrintOneURL(\"" + temp + "\");", true);

Response.Redirect(http://google.com);

这样执行只能重定向到a页面,而不执行打印。因为打印语句是执行javascript,重服务器将页面推向用户。比respon慢得多。所以重定向到另一个页面以后就不执行打印语句了。

解决方案:

可将重定向和打印都用javascript执行:

 ScriptManager.RegisterStartupScript(print_btn, this.GetType(), "sd", "location.href=' http://google.com' ;PrintOneURL(\"" + temp + "\");", true);
posted @ 2011-06-07 12:43  oY_211  阅读(192)  评论(0编辑  收藏  举报