在"利用ASP.NET AJAX的Timer讓GridView每隔一段時間做到自動換頁的功能"這篇文章裡
介紹到如何利用ajax的timer做到gridview自動換頁的功能,但有人提到換頁可否加入"淡出淺入"的效果
小弟就利用另一方式來換頁,也就是利用"ASP.NET動態產生meta資訊的應用,時間倒數10秒去另一網頁"這篇的方式換頁
在"利用ASP.NET AJAX的Timer讓GridView每隔一段時間做到自動換頁的功能"這篇文章裡
介紹到如何利用ajax的timer做到gridview自動換頁的功能,但有人提到換頁可否加入"淡出淺入"的效果
小弟就利用另一方式來換頁,也就是利用"ASP.NET動態產生meta資訊的應用,時間倒數10秒去另一網頁"這篇的方式換頁
並且加入"淡出淺入"的效果,如下所示(只要在網頁加入下列程式碼就有"淡出淺入"的效果了)
<meta http-equiv="Page-Exit" content="revealTrans(Duration=1.0,Transition=23)" />
<meta http-equiv="Page-Enter" content="revealTrans(Duration=1.0,Transition=23)" />
<meta http-equiv="Page-Enter" content="revealTrans(Duration=1.0,Transition=23)" />
asp.net(c#)
完整程式碼:
GridViewPage.aspx
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="GridViewPage.aspx.cs" Inherits="GridViewPage" %>
<!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>GridViewPage</title>
<%--加入"隨機"換頁效果--%>
<meta http-equiv="Page-Exit" content="revealTrans(Duration=1.0,Transition=23)" />
<meta http-equiv="Page-Enter" content="revealTrans(Duration=1.0,Transition=23)" />
</head>
<body>
<form id="form1" runat="server">
<div>
<asp:GridView ID="GridView1" runat="server" AllowPaging="True" PageSize="1">
</asp:GridView>
</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>GridViewPage</title>
<%--加入"隨機"換頁效果--%>
<meta http-equiv="Page-Exit" content="revealTrans(Duration=1.0,Transition=23)" />
<meta http-equiv="Page-Enter" content="revealTrans(Duration=1.0,Transition=23)" />
</head>
<body>
<form id="form1" runat="server">
<div>
<asp:GridView ID="GridView1" runat="server" AllowPaging="True" PageSize="1">
</asp:GridView>
</div>
</form>
</body>
</html>
GridViewPage.aspx.cs



















int page = 0;

if (Request.QueryString["page"] != null)





if (this.GridView1.PageCount > 1)




if (page == this.GridView1.PageCount - 1)












//每隔5秒換一次頁








//載入資料






執行結果:
參考網址:
http://www.dotblogs.com.tw/puma/archive/2008/05/06/3811.aspx
http://www.newspace.com.tw/free/page/10.asp
http://www.dotblogs.com.tw/puma/archive/2008/05/09/3912.aspx