用户名:
密 码: 记住
您当前的位置:首页 > 网络编程 > Net教程

asp.net在iframe中弹出信息并执行跳转问题探讨

时间:2015-01-29  来源:互联网  作者:佚名
复制代码 代码如下:
/// <summary>
/// iframe 中,弹出信息并跳转
/// </summary>
/// <param name="msg"></param>
/// <param name="targetPageName"></param>
public static void ResponseShowMsg(string msg, string targetPageName)
{
string str = "<script> alert('{0}'); window.parent.frames[\"sysMain\"].location.href = '{1}'; </script>";
string Urls = HttpContext.Current.Request.Url.OriginalString;
if (Urls.LastIndexOf('?') > 0)
{
Urls = Urls.Substring(0, Urls.LastIndexOf('?')).Replace(HttpContext.Current.Request.Url.Segments[HttpContext.Current.Request.Url.Segments.Length - 1], targetPageName);
}
else
{
Urls = Urls.Replace(HttpContext.Current.Request.Url.Segments[HttpContext.Current.Request.Url.Segments.Length - 1], targetPageName);
}
str = string.Format(str, msg, Urls);
HttpContext.Current.Response.Write(str);
}

页面调用 cs文件
复制代码 代码如下:
protected void btnSave_Click(object sender, EventArgs e)
{
if (bll.RoleAdd(model, tempMs))
{
CmvspCommon.MessageBox.ResponseShowMsg( "保存成功!", "add.aspx");
}
else {
CmvspCommon.MessageBox.Show(this, "保存失败!");
}
}
来顶一下
返回首页
返回首页
推荐资讯
ASP.NET笔记之 Repeater的使用 ASP.NET笔记之 Repeater的使用1、数据绑定combox-->BingdSource-->ObjectDataSource//连接
ASP.NET笔记之 控件与母板的区别分析 ASP.NET笔记之 控件与母板的区别分1、ASP.NET的好坏处CodeBehind:“前aspx后cs”的模式,(1、
相关文章
栏目更新
栏目热门