Server.Transfer之后不显示Jquery弹出窗口 [英] Jquery popup is not shown after Server.Transfer

查看:82
本文介绍了Server.Transfer之后不显示Jquery弹出窗口的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述



以下代码没问题,显示了Jquery弹出窗口。

Hi,
Following code is fine and the Jquery popup is shown.

ScriptManager.RegisterStartupScript(Me, Me.GetType(), "ShowPopup", "ShowPopup();", True)



但在下面的代码中,当Server.Transfer的额外代码行为时,弹出窗口不显示添加。


But in In the below code the popup is not shown when an extra line of code of Server.Transfer is added.

ScriptManager.RegisterStartupScript(Me, Me.GetType(), "ShowPopup", "ShowPopup();", True)
Server.Transfer("frmWelcome.aspx", True)





请帮助。



谢谢提前。



Please help.

Thanks in Advance.

推荐答案

正如评论中所提到的,你不能这样做。调用RegisterStartupScript是服务器上的代码,当客户端加载页面时,它将生成对javascript的调用。但是,该页面永远不会被加载,因为您首先转移到frmWelcome.aspx。



您可以向frmWelcome.aspx检查的查询字符串添加内容,然后显示弹出窗口在frmWelcom.aspx上。



如果你想显示弹出窗口然后重定向,可以通过将window.location设置为新的URL来在javascript中执行。
As mentioned in the comments, you can't do it like this. Calling RegisterStartupScript is code on your server that will generate a call to javascript when the page is loaded on the client. However, that page never gets loaded because you transfer to frmWelcome.aspx first.

You can add something to the querystring that frmWelcome.aspx checks for and then show the popup on frmWelcom.aspx.

If you want to show the popup and then redirect, do it in javascript by setting window.location to the new url.


这篇关于Server.Transfer之后不显示Jquery弹出窗口的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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