不显示警报消息

编程入门 行业动态 更新时间:2024-10-26 14:28:59
本文介绍了不显示警报消息的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

嗨下面是代码, 问题我有警告信息它没有显示它而控制转到下一行并重新成功发生。当我放置断点时,它进入criptManager.RegisterStartupScript但不显示消息。我已经尝试评论响应重定向并检查仍然没有去..

Hi Below is the code , Issue i have alert message its not displaying it instead control goes to the next line and re-direction happens successfully. when i place the break point it enters the criptManager.RegisterStartupScript but does not display the message. I have tried commenting the response redirect and checked still no go ..

protected void btnLoadObjectRepository_Click(object sender, ImageClickEventArgs e) { if (Session["dirtyFlag"].ToString() == "1") { ScriptManager.RegisterStartupScript(this, typeof(string), "openNewWindow", "<script>alert(You will loose the data create button is not clicked')</script>", false); } Response.Redirect("LoadObjectRepository.aspx"); }

推荐答案

里面警告你错过了'报价... Inside the alert you missed the ' quotes... ScriptManager.RegisterStartupScript(this, typeof(string), "openNewWindow", "<script>alert('You will loose the data create button is not clicked')</script>", false);

嘿伙计, 首先将jQuery文件应用到应用程序的head部分。 使用此代码后: Hey Buddy, First of all Apply a jQuery file to the head section of your application. After this use this code: Page.ClientScript.RegisterStartupScript(this.GetType(), "func", "window.top.location = ('WebForm1.aspx');", true);

H以及替换window.top.location你可以使用alert。

Here in place of window.top.location you can use alert.

试试这个。 Try this. ScriptManager.RegisterStartupScript(this, this.GetType(), "popup", "alert('Your Message here');window.location='yourpage.aspx';", true);

它将在重定向之前显示消息

it will display the message before you are redirected

更多推荐

不显示警报消息

本文发布于:2023-11-27 16:54:33,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1638830.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:警报   消息

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!