All articles| All Pictures| All Softwares| All Video| Go home page| Write articles| Upload pictures

Reading number is top 10 articles
ASP.NET,2.0中在gridview中使用DataFromatString的小技巧_[Asp.Net教程]
Apache指南:.htaccess文件使用手册_php资料_编程技术
用AjaxPro实现无刷新翻页效果及数据库分页技术介绍_[AJAX教程]
ASP.NET中广告控件AdRotator使用方法_[Asp.Net教程]
SQL,Server,2005,CE基础概要_mssql学习_编程技术
PHP和MYSQL联合打造简单留言本程序_php资料_编程技术
ASP.NET技巧:DataGridView,的分页处理_.net资料_编程技术
在,ASP.NET,中用匿名委托简单模拟,AOP,做异常和日志处理_.net资料_编程技术
ASP.NET,MVC,Framework体验(2):显示列表数据_[Asp.Net教程]
ASP.NET Remoting体系结构(二)
Reading number is top 10 pictures
Sora aoi possession of boudoir1
Startling Russian girl blind date scene3
So beauty, will let you spray blood9
西班牙山村小景2
Photographed the passion of the clients and prostitutes in the sex trade picture2
清扫五脏垃圾,我有绝招
Wild animals melee moment of life and death1
关于提肛的健身效果
NeedWallpaper14
XuRe xuan cool and refreshing photoes1
Download software ranking
Unix video tutorial1
jBuilder2006
ASP.NET.2.0.XML.高级编程(第3版)
功夫熊猫2(上集)
Wild things 2
Boxer's Top ten classic battle3
Unix video tutorial4
豪门浪荡史
Boxer vs Yellow2
JSP+Ajax Web development typical examples
delv published in(发表于) 2014/1/24 9:10:33 Edit(编辑)
一个无刷新效果定时自动更新页面的例子_[Asp.Net教程]

一个无刷新效果定时自动更新页面的例子_[Asp.Net教程]

一个无刷新效果定时自动更新页面的例子_[Asp.Net教程]

  一个无刷新效果定时自动更新页面的例子(ASP.NET2.0-应用xmlhttp)


  首先在ASP.Net创建两个WebForm页,分别命名为Default1,Default2。下面给出代码清单:


//Default1.aspx


<%@ Page Language="C#" Debug="true" AutoEventWireup="true" CodeFile="Default1.aspx.cs" Inherits="Default1" %>
http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
http://www.w3.org/1999/xhtml" >

无标题页





Ajax Dynamic Update Example


This page will automatically update itself:
onclick="doStart();"/>


Page will refresh in 1 seconds.















//Default2.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 Default2: System.Web.UI.Page
{
private static int counter = 1;
protected void Page_Load(object sender, EventArgs e)
{
String res = "";
String task = this.Request.Params["task"];
String message = "";
if (!string.IsNullOrEmpty(task))
{
if (task.Equals("reset"))
{
counter = 1;
}
else
{
switch (counter)
{
case 1: message = "Steve walks on stage"; break;
case 2: message = "iPods rock"; break;
case 3: message = "Steve says Macs rule"; break;
case 4: message = "Change is coming"; break;
case 5: message = "Yes, OS X runs on Intel - has for years"; break;
case 6: message = "Macs will soon have Intel chips"; break;
case 7: message = "done"; break;
}
counter++;
}
res = "" + message + "";
Response.ContentType = "text/Xml";
Response.AppendHeader("Cache-Control", "no-cache");
Response.Write("");
Response.Write(res);
Response.Write("
");
Response.End();
}
}
}








添加到del.icio.us 添加到新浪ViVi 添加到百度搜藏 添加到POCO网摘 添加到天天网摘365Key 添加到和讯网摘 添加到天极网摘 添加到黑米书签 添加到QQ书签 添加到雅虎收藏 添加到奇客发现 diigo it 添加到饭否 添加到飞豆订阅 添加到抓虾收藏 添加到鲜果订阅 digg it 貼到funP 添加到有道阅读 Live Favorites 添加到Newsvine 打印本页 用Email发送本页 在Facebook上分享


Disclaimer Privacy Policy About us Site Map

If you have any requirements, please contact webmaster。(如果有什么要求,请联系站长)
Copyright ©2011-
uuhomepage.com, Inc. All rights reserved.