代码示例:使用AJAX.NET TIMER控件
来源:互联网 发布:sql查询oracle数据库 编辑:程序博客网 时间:2024/06/04 19:03
示例ASPX页面代码:
<%...@ Page Language="C#" AutoEventWireup="true" CodeBehind="Default.aspx.cs" Inherits="AJAXTIMESIMPLE._Default" %>
<!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>Untitled Page</title>
</head>
<body>
<form id="form1" runat="server">
<asp:ScriptManager ID="ScriptManager1" runat="server" />
<div>
<asp:UpdatePanel ID="UpdatePanel1" runat="server">
<ContentTemplate>
<asp:Timer ID="Timer1" runat="server" Interval="10000" OnTick="Timer1_Tick">
</asp:Timer>
<asp:Label ID="lblRefresh" runat="server" Text="Panel not refreshed yet" Width="174px"></asp:Label>
</ContentTemplate>
</asp:UpdatePanel>
<asp:Label ID="lblNoFresh" runat="server"></asp:Label></div>
</form>
</body>
</html>
<!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>Untitled Page</title>
</head>
<body>
<form id="form1" runat="server">
<asp:ScriptManager ID="ScriptManager1" runat="server" />
<div>
<asp:UpdatePanel ID="UpdatePanel1" runat="server">
<ContentTemplate>
<asp:Timer ID="Timer1" runat="server" Interval="10000" OnTick="Timer1_Tick">
</asp:Timer>
<asp:Label ID="lblRefresh" runat="server" Text="Panel not refreshed yet" Width="174px"></asp:Label>
</ContentTemplate>
</asp:UpdatePanel>
<asp:Label ID="lblNoFresh" runat="server"></asp:Label></div>
</form>
</body>
</html>
示例后台C#代码:
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;
namespace AJAXTIMESIMPLE
...{
public partial class _Default : System.Web.UI.Page
...{
protected void Page_Load(object sender, EventArgs e)
...{
lblNoFresh.Text = "Page created at: " + DateTime.Now.ToLongTimeString();
}
protected void Timer1_Tick(object sender, EventArgs e)
...{
lblRefresh.Text = "Panel refreshed at: " + DateTime.Now.ToLongTimeString();
}
}
}
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;
namespace AJAXTIMESIMPLE
...{
public partial class _Default : System.Web.UI.Page
...{
protected void Page_Load(object sender, EventArgs e)
...{
lblNoFresh.Text = "Page created at: " + DateTime.Now.ToLongTimeString();
}
protected void Timer1_Tick(object sender, EventArgs e)
...{
lblRefresh.Text = "Panel refreshed at: " + DateTime.Now.ToLongTimeString();
}
}
}
- 代码示例:使用AJAX.NET TIMER控件
- 代码示例:在多个UpdatePannel使用AJAX.NET TIMER控件
- AJAX Timer控件的使用
- ASP.NET AJAX Timer 控件概述
- ASP.NET AJAX Timer 控件概述
- ASP.Net Ajax框架 Timer控件 计时器
- ASP.NET AJAX入门系列(10):Timer控件简单使用
- ASP.NET AJAX入门系列(11):在多个UpdatePanle中使用Timer控件
- ASP.NET AJAX入门系列(10):Timer控件简单使用
- ASP.NET AJAX入门系列(11):在多个UpdatePanle中使用Timer控件
- ASP.NET AJAX入门系列(10):Timer控件简单使用
- ASP.NET AJAX入门系列:在多个UpdatePanle中使用Timer控件
- ASP.NET AJAX入门系列(10):Timer控件简单使用
- ASP.NET AJAX入门系列(11):在多个UpdatePanle中使用Timer控件
- ASP.NET AJAX入门系列(10):Timer控件简单使用
- ASP.NET AJAX入门系列(11):在多个UpdatePanle中使用Timer控件
- ASP.NET AJAX入门系列(10):Timer控件简单使用
- ASP.NET AJAX入门系列(11):在多个UpdatePanle中使用Timer控件
- 巴菲特语录
- 数字图书馆发展趋势及其需要解决的问题(概要)
- 重写alert方法完成类似gmail的友好提示
- 第四代Internet防火墙技术解析zt
- 07年三季度微软将推出支持Office Mobile 2007的WindowsMobile6
- 代码示例:使用AJAX.NET TIMER控件
- 优秀程序员的两大要素:懒 + 笨
- 按层遍历二叉树
- 【STL】c++primer里面关于iterator的定义
- 二叉树先序遍历(递归算法)
- 二叉树的先序遍历(非递归算法)
- 如何才能控制P2P流量
- 在linux下如何显示隐藏文件
- LUPA两周年庆:"支持开源 抵制盗版"主题活动