更新 UpdatePanels 后在初始加载时添加 Javascript
在页面的 Page_Load 命令中,我在显示屏幕之前执行了一些测试,如果用户无法访问屏幕,则会显示一个警告框。
If Not Page.IsPostBack Then
UpdatePanel1.ContentTemplateContainer.Controls.Add(ctl)
UpdatePanel1.Update
UpdatePanel2.ContentTemplateContainer.Controls.Add(ctl)
UpdatePanel2.Update
If ScreenAccessible = False
ScriptManager.RegisterStartupScript(Me, Me.GetType(), "denied", "alert('Access Denied');", True)
End If : End If
我假设根据上述过程的顺序,更新面板应首先更新,然后警报消息将随之更新。
但是,警报消息首先显示,更新面板为空。当我单击警报框中的“确定”按钮时,更新面板将正确呈现。
如何允许 JavaScript 警告框在更新面板呈现后出现?
On my Page_Load command for a page, I have a couple of tests that are performed before the screen is displayed with an alert box displaying if the user cannot access the screen.
If Not Page.IsPostBack Then
UpdatePanel1.ContentTemplateContainer.Controls.Add(ctl)
UpdatePanel1.Update
UpdatePanel2.ContentTemplateContainer.Controls.Add(ctl)
UpdatePanel2.Update
If ScreenAccessible = False
ScriptManager.RegisterStartupScript(Me, Me.GetType(), "denied", "alert('Access Denied');", True)
End If : End If
I would assume that based on the order of the procedure above, the update panels should update first, and then the alert message will follow.
However, the alert message shows up first, with the update panels empty. When I click the OK button on the alert box, the update panels are correctly render.
How do I allow the JavaScript alert box to appears after the update panels have rendered?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您尝试过吗:
参考:
http://www.w3schools.com/jsref/met_win_settimeout.asp
Did you try:
Reference:
http://www.w3schools.com/jsref/met_win_settimeout.asp