代码如下:
DownLoadExcel(exceltable,"outputfiles");//此功能为弹出保存文件对话框,并保存Excel文件
string str= 
"<Scriptlanguage='javascript'>window.parent.opener.location.href=window.parent.opener.location.href;</script>";
Page.RegisterStartupScript("str", str);我想保存一个excel文件,然后再刷新父页面,入把弹出保存文件对话框那行代码去掉,可以刷新父页面,但加上后就不行了,求救解决方法!

解决方案 »

  1.   

    例如用的是button,那么在button服务器端的click中加上:Response.Redirect("url");
    //*.aspx
    <script language="javascript">
    function ShowDialog()
    {
    var returnvalue = window.showModalDialog("Company_Add.aspx",window,"dialogWidth:300px;dialogHeight:300px");
    if(returnvalue=='Success')
    {
    self.location.href=document.location.href;
    }
    }
    </script>
    /////////
    <A onclick="ShowDialog();" href="#">
    <asp:button id="btnAddNew" runat="server" Text="新增" CausesValidation="False" Width="70px"></asp:button>
    </A>
    //*.cs
    private void btnAddNew_Click(object sender, System.EventArgs e)
    {
    Response.Redirect("Company_Define.aspx");
    }