如何让一个页面 控制另一个页面的更新
比如 index.aspx页面中 有个GRIDVIEW的表
我在 add.aspx页面中 有个BUTTON(就是增加一条记录) 点了后 add.aspx页面关闭 然后
index.aspx的内容要刷新
比如 index.aspx页面中 有个GRIDVIEW的表
我在 add.aspx页面中 有个BUTTON(就是增加一条记录) 点了后 add.aspx页面关闭 然后
index.aspx的内容要刷新
调试欢乐多
问一下 index.aspx 是用双引号 还是 单引号亚
单引号
主页面的 gridview的数据还是没有刷新
不知道还有什么地方要注意的
Public Shared Sub refreshwindow(Optional ByVal willClose As Boolean = False)
If m_executingPages.Contains(HttpContext.Current.Handler) = False Then
Dim executingPage As Page = HttpContext.Current.Handler
If (Not executingPage Is Nothing) Then
Dim sb As StringBuilder = New StringBuilder
sb.Append("<script language='javascript'>")
If willClose = True Then
sb.Append("window.returnValue='Refresh';window.close();")
End If
sb.Append("</script>")
executingPage.RegisterStartupScript("closeScript", sb.ToString())
End If
End If
End Sub
//在B.aspx的提交按钮中添加如下代码,效果为刷新父窗口,关闭子窗口。
Response.Write("<script>window.opener.__doPostBack('','');top.opener =null;top.close();</script>");
//在B.aspx的提交按钮中添加如下代码,效果为刷新父窗口,关闭子窗口。
Response.Write("<script>window.opener.__doPostBack('','');top.opener =null;top.close();</script>");
这里面就一个逗号???
Response.Write("<script language=javascript>opener.location.reload();window.close();</script>")
function showModal300X350(sFile,refreshed){
var sReturn=window.showModalDialog(sFile,"popUp","dialogHeight:300px;dialogWidth:350px;status:no;help:no;edge: Raised;");
//如果sReturn返回'Refresh'和refreshed为直,刚Refreshpage
if((refreshed)&&(sReturn=='Refresh')) {
window.location.href = unescape(window.location.href);
}
}index.aspx的load事件有加载GRIDVIEW的过程
add.aspx页面中 BUTTON 添加一个方法,如下 public void refreshwindow()
{
if (m_executingPages.Contains(HttpContext.Current.Handler) == false )
{
Page executingPage = HttpContext.Current.Handler as Page ;
if ( executingPage != null)
{
StringBuilder sb=new StringBuilder();
sb.Append("<script language='javascript'>");
sb.Append("window.returnValue='Refresh';window.close();");
sb.Append("</script>");
executingPage.RegisterStartupScript("closeScript", sb.ToString());
} }
}
Response.Write("<script>openner.location.reload('index.aspx');window.close()</script>");
Response.Write("<script>window.location.href='index.aspx';window.close()</script>");
上面这2个 我都试过 都不行
在index.aspx 中
设定一个方法
<script>
function ClientClick
{
document.getElementById("<%=btnRefresh.ClientID%>").click();//btnRefresh为刷新按钮
}
</script>
在add.aspx中
Response.Write("<script>opener.ClientClick();window.close()</script>");