问题
On my ASP.NET page I am using an iframe and setting its source in code behind the page.
Markup
<asp:TabPanel ID="tabDocs" Enabled="false" HeaderText="Documents" runat="server">
<ContentTemplate>
<iframe width="100%" height="600" id="frmDocs" frameborder="0" runat="server"></iframe>
</ContentTemplate>
</asp:TabPanel>
Code Behind
frmDocs.Attributes.Add("src", "/xyz.aspx?vType=EmpRpt&vid=" + EmpID.ToString)
There is a Create Report button on the page, which will save a report in the database and then show the file details (i.e. file name, size and etc.) on page xyz.aspx
.
After saving the report I am using Response.Redirect(Request.RawUrl)
to refresh the whole page.
Is there any way of reloading just xyz.aspx
showing it in a tab instead of reloading the whole page?
回答1:
This is not an ASP.NET problem per se - just incidentally.
Consider using JavaScript to reload the iframe
as another SO question addresses.
One possibility per one of the answers to it that you should be able to adapt for your needs is...
document.getElementById('frmDocs').src = document.getElementById('frmDocs').src
..., but there are others you can consider too.
来源:https://stackoverflow.com/questions/24308243/refresh-aspx-page-in-asp-net-tab-panel