window.opener.location.reload();
把datagrid的数据源(dataset或者datatable)做为参数传给子窗体就ok
形如 frmChild frm = new frmChile(dataTable);
当子窗体关闭时候,父窗体会自动更新
如果是自定义实体类,则需要实现 IBindingList and IEditableObject interfaces,
see Windows Forms Data Binding and Objects
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dnadvnet/html/vbnet02252003.asp
function GuanBiHeShuaXin()
{
window.opener.location.href=window.opener.location.href;
self.close();
}
如果用户已经点过某些按钮,用"location.reload()"就会出现提示,这是不可避免的,所以,特别是在webform中,最好不要用reload;
可以用window.opener.loaction.href = window.opener.location.href 来刷新,
简单的说,location.href就是地址,"window.opener.loaction.href = window.opener.location.href"就是设置父窗口的地址为父窗口当前的地址,这个操作会导致页面刷新,但也有问题,此时服务器会执行page_load中
if(!Page.IsPostBack)
{
...
}
中的代码,有时这和我们想要的情况不一样.
最好是在父窗口页面中弄一个更新用的function,放一个hiddenInput,
要更新时,调用该function,设置标识值,然后采用"Form1.submit()"的方式来刷新页面,
服务器中在page_load里判断该hiddenInput的值,按情况进行处理.
这种方法最麻烦,不过比较保险
你弹出的新窗体是用什么弹出的呢?如果是用window.showModalDialog()的话,你可以在window.showModalDialog()之后加上document.forms[0].submit()这一句就可以了,子窗体的代码不要做任何改动;
Response.Write("<script language='javascript'>
window.opener.location.Reload();window.close();</script>");
我是用window.open(URL)来打开新的窗口的。
如果你用了自动分页,那window.opener.location.reload();刷新会弹出窗口
所以最好还是自己分页,保证你的列表是GET方式访问的,这样window.opener.location.reload();就是对的了