本文转自http://www.cnblogs.com/freeliver54/archive/2008/12/29/1364273.html
调用定时回发页面的主框架页面的Left菜单页面:
HTML部分
=======
<from>
/* */
<iframe src="Message/RefreshMessage.aspx" height="0" runat="server" id="iframeRefresh" ></iframe>
</form>
.cs部分
=======
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部分
=======
<%@ 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部分
=======
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";
}
}
}
外出网 www.waichu.net
发酷网 www.faako.com