调用定时回发页面的主框架页面的Left菜单页面:
HTML部分
=======
Code
<from>
/* */
<iframe src="Message/RefreshMessage.aspx" height="0" runat="server" id="iframeRefresh" ></iframe>
</form>
<from>
/* */
<iframe src="Message/RefreshMessage.aspx" height="0" runat="server" id="iframeRefresh" ></iframe>
</form>
.cs部分
=======
Code
protected void Page_Load(object sender, EventArgs e)
{
if (Session["isRefresh"] != null && Session["isRefresh"].ToString() == "1")
{
this.iframeRefresh.Attributes["src"] = "ReloadOnTime.aspx";
}
else
{
this.iframeRefresh.Attributes["src"] = "OtherReloadOnTime.aspx";
}
}
protected void Page_Load(object sender, EventArgs e)
{
if (Session["isRefresh"] != null && Session["isRefresh"].ToString() == "1")
{
this.iframeRefresh.Attributes["src"] = "ReloadOnTime.aspx";
}
else
{
this.iframeRefresh.Attributes["src"] = "OtherReloadOnTime.aspx";
}
}
定时回发页面ReloadOnTime.aspx
HTML部分
=======
Code
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="ReloadOnTime.aspx.cs" Inherits="ReloadOnTime" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
<title>刷新Session</title>
</head>
<body>
<form id="form1" runat="server">
<asp:TextBox ID="hidtxt_isRefresh" runat="server"></asp:TextBox>
</form>
</body>
</html>
<script type="text/javascript" language='javascript'>
window.onload=function()
{
if(document.all.hidtxt_isRefresh.value=="1")
{
window.setInterval("fn_BtnEventOnTime()",600000);
}
}
function fn_BtnEventOnTime()
{
window.location.reload();
}
</script>
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="ReloadOnTime.aspx.cs" Inherits="ReloadOnTime" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
<title>刷新Session</title>
</head>
<body>
<form id="form1" runat="server">
<asp:TextBox ID="hidtxt_isRefresh" runat="server"></asp:TextBox>
</form>
</body>
</html>
<script type="text/javascript" language='javascript'>
window.onload=function()
{
if(document.all.hidtxt_isRefresh.value=="1")
{
window.setInterval("fn_BtnEventOnTime()",600000);
}
}
function fn_BtnEventOnTime()
{
window.location.reload();
}
</script>
.cs部分
=======
Code
using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
public partial class ReloadOnTime : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
//如果页面不让因用户不操作而过期
if (Session["isRefresh"] != null)
{
if (Session["isRefresh"].ToString() == "1")
{
this.hidtxt_isRefresh.Text = "1";
}
else
{
this.hidtxt_isRefresh.Text = "0";
}
}
else
{
this.hidtxt_isRefresh.Text = "0";
}
}
}
using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
public partial class ReloadOnTime : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
//如果页面不让因用户不操作而过期
if (Session["isRefresh"] != null)
{
if (Session["isRefresh"].ToString() == "1")
{
this.hidtxt_isRefresh.Text = "1";
}
else
{
this.hidtxt_isRefresh.Text = "0";
}
}
else
{
this.hidtxt_isRefresh.Text = "0";
}
}
}