我在cs中的代码如下:
protected void Button1_Click(object sender, EventArgs e)
{
Response.Write("<script>window.close()</script>");
}
怎么不能实现啊?
protected void Button1_Click(object sender, EventArgs e)
{
Response.Write("<script>window.close()</script>");
}
怎么不能实现啊?
解决方案 »
- 求一条数据分类汇总数据的语句
- FreeTextBox控件如何保存至数据库中出错! 请指教,谢谢!
- 客户端控制服务器控件问题(急)
- 如何给网页中的文本框设置焦点
- ifnew(string(@created))这个要改成跟今天相比,什么改
- ASP.net 的按钮和文本框样式是怎么弄的?
- //====到底该怎样访问数据库呢,我还是不停的写Sql语句,好烦哦,.Net里有没有类似J2ee中的由容器管理的EJB的技术呢,或者有什么好的数据库访
- 请问:我把32位虚拟机上的Oracle9i中的数据导入到了64位虚拟机Oracle11g中,
- 从数据库中读取图片时显示不了。
- 老大和前辈给给我这个菜鸟一些意见
- CommandName="delete" 是什么意思一定要写delete吗?
- 【求教】后台调用js方法跳转界面,在跳转过程中传参。
在弹出的窗口的close Response.Write("<script language='javascript'>window.opener.location.href='aaa.apsx';window.close();</script>");
在主页面加一个LinkButton,在LinkButton的单击事件里面重新绑定要绑定的东西
然后在子页面里面关闭时用这句代码
ScriptManager.RegisterStartupScript(this.Page, GetType(), "infor", "alert('添加成功!');window.opener.LinkButton.click();window.close();", true);
father.aspx<script language='javascript'>function OpenChild()
{
window.open('Child.aspx','anyname','width=530,height=310,status=no,toolbar=no, menubar=no,location=no');
}
</script>
<body>
<form id="form1" runat="server">
<div>
<input id="Button1" type="button" value="OpenChild" onclick="OpenChild()" />
</div>
</form>
</body>Child.aspx<body>
<form id="form1" runat="server">
<div>
<asp:Button ID="Button1" runat="server" Text="Close" OnClick="Button1_Click" />
</div>
</form>
</body>Child.aspx.cs protected void Button1_Click(object sender, EventArgs e)
{
Response.Write("<script language='javascript'>window.opener.location.href='father.aspx';window.close();</script>");
}
你自己测试看看啊
ScriptManager.RegisterStartupScript(this.Page, GetType(), "infor", "alert('添加成功!');window.opener.LinkButton.click();window.close();", true);
{
Response.Write("<script language='javascript'>window.opener.location.href='father.aspx';window.close();</script>");
}点击按钮没反应啊
child的页面是否关闭,father的页面是否重新加载?
function OpenChild()
{
window.showModalDialog("AddFolders.aspx","新增文件夹","dialogWidth:450px;dialogHeight:150px;center:yes;help:no;resizable:no;status:no")
}如果是模式窗体该怎么办
function OpenChild()
{
window.showModalDialog("AddFolders.aspx","新增文件夹","dialogWidth:450px;dialogHeight:150px;center:yes;help:no;resizable:no;status:no")
}如果是模式窗体该怎么办
if (typeof(sReturn) != "undefined")
{
if (sReturn=="1")
{
document.all["btnFresh"].focus();
}
} 然后在子页面提价一下JS代码function reload()
{
window.parent.returnValue='1';window.close();
}因为是showModalDialog 所以记住加入 <base target="_self"/>
其实用弹出窗口比较好控制。你自己试试了。
这句话加在你子窗体的最后
如果你的子窗体是新增一个东西,那么在你插入语句的后面加上这句话就行了
bool insert=sqlhelp.Update();
if(insert)
ScriptManager.RegisterStartupScript(this.Page, GetType(), "infor", "alert('添加成功!');window.opener.LinkButton.click();window.close();", true);
{
var url;
url = "DocumentAdd.aspx?Doc_ID=" +strID+"&action=update";
window.showModalDialog(url,window,'dialogwidth:800px;dialogheight=300px;status=no;help=no;resizable=no;scroll=no;center=yes;location=no');
} 执行修改后关闭弹出页面并刷新父页面 if (result > 0)
{
string url = GetUrl();
Response.Write("<script language=javascript>alert('修改成功!');window.dialogArguments.location.assign('" + url + "');</script>");
Response.Write("<script>window.close();</script>");
Response.Write("<script> window.dialogArguments.location.reload();</script>");
Response.End(); }弹出窗需要在<head></head>标签中加入<base target="_self" /> 测试通过~