读书人

关于模态窗口关闭刷新框架中的一个

发布时间: 2012-01-29 21:39:32 作者: rapoo

在线等,关于模态窗口关闭,刷新框架中的一个iframe问题,
问题是这样的:我有一个框架分left ,right两个页面,在right页面中有一个GRIDVIEW显示数据,当单击GRIDVIEW任意行时显示一个模态窗口,用来修改记录,更新后关闭模态窗口。问题是关闭后不能刷新框架里的right页面,GRIDVIEW显示得数据还是修改前的数据。试了好多方法都不行。我的代码如下:

单击GRIDVIEW任意行时显示一个模态窗口的代码:
protected void GridView1_RowDataBound(object sender, GridViewRowEventArgs e)
{

if (e.Row.RowType == DataControlRowType.DataRow)
{

e.Row.Attributes.Add("onclick", "window.showModalDialog( 'SunStudio_bzxq.aspx?bzxh_id=" + e.Row.Cells[0].Text + " ',window, 'dialogWidth=650px;dialogHeight=500px;help:no;status:no ')");



}
}

更新记录后关闭模态窗口代码:
protected void Button1_Click(object sender, EventArgs e)
{

Response.Write("<script>window.alert('修改成功!');window.opener=null;window.close();</script>");
Response.Write("window.dialogArguments.location.assign('Main_Edit.aspx');");

}
程序执行时Button1_Click事件时,关闭了模态窗口,但没有刷新父页面。请大家帮我看看,实在是没招了,我觉得是参数传递的问题。



[解决办法]
ClientScript.RegisterStartupScript(this.GetType(), "", "<script>alert('确认成功');window.close();window.opener.location.href = window.opener.location.href;</script>");
//提示确认成功并且,关闭然后刷新父窗口
[解决办法]
e.Row.Attributes.Add("onclick", "window.showModalDialog( 'SunStudio_bzxq.aspx?bzxh_id=" + e.Row.Cells[0].Text + " ',window, 'dialogWidth=650px;dialogHeight=500px;help:no;status:no ');window.location.href=window.location.href; ");



读书人网 >asp.net

热点推荐