简体   繁体   English

我如何先显示警告框,然后重定向到带有查询字符串的任何页面?

[英]How do I show the Alert Box first and then redirect to any page with query strings?

ScriptManager.RegisterStartupScript(UpdatePanel2, this.GetType(), "click", "alert('This Email address is already registered...');window.location.href ='test.aspx'", true);

By using the above code i able to show alert box and after that redirect to test.aspx page.通过使用上面的代码,我能够显示警告框,然后重定向到 test.aspx 页面。

But problem come when i have to pass query string with address like:但是当我必须传递带有地址的查询字符串时,问题就来了:

ScriptManager.RegisterStartupScript(UpdatePanel2, this.GetType(), "click", "alert('This Email address is already registered...');window.location.href ='test.aspx?WidgetID='" + Request.QueryString["WidgetID"] + "'&lan='" + readCookie() + "'&seeHome=true'", true);

thanks in advance提前致谢

your code has unnecessary (') s which breaks the string in javascript. Try this您的代码有不必要的 (') s,它会破坏 javascript 中的字符串。试试这个

ScriptManager.RegisterStartupScript(UpdatePanel2, this.GetType(), "click", "alert('This Email address is already registered...');window.location.href ='test.aspx?WidgetID=" + Request.QueryString["WidgetID"] + "&lan=" + readCookie() + "&seeHome=true'", true);

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 如何从.net应用程序中的javascript警报框重定向到其他页面? - How to redirect to a different page from a javascript alert box in a .net application? 如何在MVC4中使用所有查询字符串和哈希值重定向移动设备? - How do I redirect a mobile device with all query strings and hash in MVC4? 如何在重定向之前显示消息 - How do I show a message before redirect 我如何将 Console.Write 重定向到 asp.net 网页的 TextBox。有什么办法吗? - How do i Redirect Console.Write to TextBox of asp.net web page.Is there any way? 如何在重定向页面之前获取警报消息 - How to get alert message before redirect a page 301我如何重定向到主页? - how do i 301 Redirect to home page? 在server.execute(“ ../../ abc.aspx”)之后,如何在我的第一页上获得控件。 我必须在server.execute()之后显示警报 - how can I to get controls back on my first page after server.execute(“../../abc.aspx”). I have to show an alert after server.execute() 如何在ASP .NET页上显示警报消息? - How do I display an alert message on my ASP .NET page? 如何将带有查询字符串的URL作为查询字符串发送 - How do I send a URL with Query Strings as a Query String 如何在不同文本框中的阵列中显示所有不同的字符串? - How do I show all different strings in an ARRAY in DIFFERENT textboxes?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM