如何在Response.Redirect之后显示javascript消息? [英] how to display javascript message after Response.Redirect?
本文介绍了如何在Response.Redirect之后显示javascript消息?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
if (dtcheck.Rows [ 0 ] [ status]。ToString()== 1)
{
Response.Redirect( AddEmployee.aspx跨度>);
}
else
{
ScriptManager.RegisterClientScriptBlock( this .Page, this .GetType(), insert, alert('亲爱的 + fpsPL.username + 您没有权限。');,真跨度>);
Response.Redirect( MasterHome.aspx);
}
当Respone.Redirect(MasterHome.aspx);调用,然后Javascript消息不显示..我可以显示这个javascript消息吗?
解决方案
这是一个自定义警报框,在单击确定它将重定向到指定页面。
var dialogConfirmed = false ;
函数AlertRedirect(obj,title,dialogText,url){
if (!dialogConfirmed){
(' body')。append(字符串 .Format( < div id =对话框 >< p> {1}< / p>< / div>,
title ,dialogText));
(' #dialog') .dialog
({
height: 100 ,
width: 200 ,
模态: true ,
可调整大小: false ,
draggable: false ,
position:' center',
closeOnEscape: true ,
close:function( event ,ui) {
if (dtcheck.Rows[0]["status"].ToString() == "1")
{
Response.Redirect("AddEmployee.aspx");
}
else
{
ScriptManager.RegisterClientScriptBlock(this.Page, this.GetType(), "insert", "alert('Dear " + fpsPL.username + " you dont have permission. ');", true);
Response.Redirect("MasterHome.aspx");
}
when Respone.Redirect("MasterHome.aspx"); call,then Javascript message is not display..how can i show this javascript message?
解决方案
This is a custom alert box, on clicking ok it will redirect to specified page.
var dialogConfirmed = false; function AlertRedirect(obj, title, dialogText, url) { if (!dialogConfirmed) {
('body').append(String.Format("<div id="dialog"><p>{1}</p></div>", title, dialogText));
('#dialog').dialog ({ height: 100, width: 200, modal: true, resizable: false, draggable: false, position: 'center', closeOnEscape: true, close: function (event, ui) {
这篇关于如何在Response.Redirect之后显示javascript消息?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文