不显示警报消息 [英] Alert message is not displayed
本文介绍了不显示警报消息的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
嗨下面是代码,
问题我有警告信息它没有显示它而控制转到下一行并重新成功发生。当我放置断点时,它进入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
这篇关于不显示警报消息的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文