[英]Refresh iframe when refreshing page
我有一個網頁,它有一個頁面標題內容,如主菜單,徽標等。
在iframe中,我正在加載側邊菜單和內容。 加載網頁時,我正在使用一個空主頁顯示。 在翻閱該頁面的某個頁面中間的某個時間后,它將重新加載主頁。 但是我需要顯示我正在用作當前頁面的頁面
代碼是
<form id="form1" runat="server">
<div>
<table>
<tr>
<td style="vertical-align: top; width: 100%" height="115px">
<div>
<uc1:MainMenu ID="ucMainMenu" runat="server" />
</div>
</td>
</tr>
<tr>
<td>
<iframe src="HomePage.aspx" runat="server" width="1250px" height="675px" id="ifSideMenu"
frameborder="0"></iframe>
</td>
</tr>
</table>
</div>
</form>
在該iframe默認頁面中,Homepage.aspx是空白頁面。 當我單擊子菜單時,它將加載類似AddMaster.aspx的內容。 當我刷新頁面時,它將加載Homepage.aspx,但是我需要顯示AddMaster.aspx
幫我
此代碼將幫助您僅刷新iframe,而不刷新整個網頁。 但是,我不太明白你的兄弟。
<IFRAME id="frame1" src="http://www.google.com/" runat="server">
<script type="text/javascript">
function refreshiframe()
{
parent.frame1.location.href="http://www.google.com/"
setTimeout("refreshiframe()",3000);
}
</script>
<body onload="refreshiframe();">
我終於找到了這個問題的答案。
它可能對其他人有幫助。
在HomePage.aspx和其他要在iframe中加載的頁面中添加以下代碼
Session["CurrentPage"] = Request.RawUrl.ToString().Replace(Request.ApplicationPath.ToString() + @"/", "");
在頁面加載事件的主頁中。
if (Session["CurrentPage"] == null)
Session["CurrentPage"] = "Exit_Tracker.aspx";
ifSideMenu.Attributes["src"] = Session["CurrentPage"].ToString();
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.