ClientScript.RegisterStartupSc ... [英] ClientScript.RegisterStartupSc...

查看:141
本文介绍了ClientScript.RegisterStartupSc ...的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用了ClientScript.RegisterStartupScript(GetType(),null,window.open('PdfReport.aspx');,true);.最初它正在工作,但是当我添加了会话变量时..这段代码停止了工作..

这里是代码:

i used ClientScript.RegisterStartupScript(GetType(), null, "window.open('PdfReport.aspx');", true);.initially it was working,, but when i added session variable.. this code stopped working..
here is the code:

{
Session["PostedStatus"] = "Record Posted Successfully !!!";
ClientScript.RegisterStartupScript(GetType(), null, "window.open('PdfReport.aspx');", true);
}
 Response.Redirect("MainMenu.aspx");







会阻止执行ClientScript?任何帮助




is session preventing execution of ClientScript?? any help

推荐答案

{
Session["PostedStatus"] = "Record Posted Successfully !!!";
ClientScript.RegisterStartupScript(GetType(), null, "window.open('PdfReport.aspx');", true);
}
 Response.Redirect("MainMenu.aspx"); // this line will redirect to the next page ,so the javascript wont execute...


感谢karthik ..根据你的评论..我在response.redirect及其工作的javascript代码中添加了location.replace,非常感谢
thanks karthik.. as per your comment.. i added location.replace in javascript code insted of response.redirect and its working,, thanks a lot


这篇关于ClientScript.RegisterStartupSc ...的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆