C#在后台注册一个脚本,打开一个子窗口,显示在屏幕中间,关闭子窗体刷新子窗体代码
2011-04-26 16:58
876 查看
在Gridview控件的RowCommand事件里写
if (e.CommandName == "unBd")
{
string id = e.CommandArgument.ToString();
ScriptManager.RegisterStartupScript(this.Page, this.GetType(), "click", "var width=Math.round((window.screen.width-380)/2);var height=Math.round((window.screen.height-150)/2);window.open('UnBanding.aspx?id=" + id + "&t=v','unbing','height=150, width=380, top='+height+', left='+width+', toolbar=no, menubar=no, scrollbars=no, resizable=no,location=n o, status=no');", true);
}
/////////////在子窗体里,完成一些操作后,关闭子窗体,同时刷新父页面,子页面要加上 <base target="_self" />////////////
ScriptManager.RegisterStartupScript(this.Page, this.GetType(), "click", "window.alert('操作成功!');window.opener.location.href=window.opener.location.href;window.close();", true);
if (e.CommandName == "unBd")
{
string id = e.CommandArgument.ToString();
ScriptManager.RegisterStartupScript(this.Page, this.GetType(), "click", "var width=Math.round((window.screen.width-380)/2);var height=Math.round((window.screen.height-150)/2);window.open('UnBanding.aspx?id=" + id + "&t=v','unbing','height=150, width=380, top='+height+', left='+width+', toolbar=no, menubar=no, scrollbars=no, resizable=no,location=n o, status=no');", true);
}
/////////////在子窗体里,完成一些操作后,关闭子窗体,同时刷新父页面,子页面要加上 <base target="_self" />////////////
ScriptManager.RegisterStartupScript(this.Page, this.GetType(), "click", "window.alert('操作成功!');window.opener.location.href=window.opener.location.href;window.close();", true);
相关文章推荐
- 后台打开一个子窗口,显示在屏幕中间,关闭子窗体刷新子窗体代码 .
- C#Form打开一个新窗口的同时关闭这个窗体
- C# 实现MDI子窗体只打开一个(打开新的窗口,关闭其他窗口)
- c# 在打开一个窗体的同时关闭本窗体(以vs2005为例)
- C#中MDI窗体关闭显示代码搜集整理
- 运行java时,窗体在屏幕中间显示的代码
- 代码实现从我的主窗体里打开另外一个应用程序,并且让该程序像自己的MDI子窗体那样在父窗体的范围内显示
- C#中MDI窗体关闭显示代码搜集整理
- C#关闭一个窗口的同时打开另一个窗口
- 带客户端脚本的图片控件,可利用后台代码修改图片显示(C#代码)
- C#在一个窗口中打开另一个窗口,同时关闭该窗口
- Python pyQt4/pyQt5 学习笔记1(空白窗口,按钮,控件事件,控件提示,窗体显示到屏幕中间,messagebox)
- eclipse 编辑窗口不见了(打开左边的java、xml文件,中间不会显示代码)
- C#Form打开一个新窗口的同时关闭这个窗体
- C#中MDI窗体关闭显示代码
- 使用C#打开新窗口关闭旧窗口的方法;winform中防止重复打开多个相同子窗体
- eclipse 编辑窗口不见了(打开左边的java、xml文件,中间不会显示代码)
- C#后台向前台注册脚本的代码
- 使用C#打开新窗口关闭旧窗口的方法;winform中防止重复打开多个相同子窗体
- c#中如何打开一个新窗口并且 关闭当前的窗口