LuckStar
大师看我沉沦魔道,我却笑大师心中痴迷,这世间万道,皆在道理,难道你的岸方是岸,我的岸便是海吗?
博客园
社区
首页
新随笔
联系
管理
订阅
随笔- 12 文章- 4 评论- 9
DataListW分页代码
using
System;
using
System.Data;
using
System.Configuration;
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;
using
System.Data.SqlClient;
class
DataList分页
...
{
protected
void
Page_Load(
object
sender, EventArgs e)
...
{
if
(
!
Page.IsPostBack)
...
{
FillData();
}
}
static
PagedDataSource Pds;
void
FillData()
...
{
SqlConnection Conn
=
new
SqlConnection(
"
Data Source=192.168.1.30;database=Ticket_Info_Data;UID=sa;Password=sa;Persist Security Info=True;
"
);
Conn.Open();
SqlDataAdapter Sda
=
new
SqlDataAdapter(
"
select * from DomesticFlight
"
, Conn);
DataSet Ds
=
new
DataSet();
Sda.Fill(Ds);
Pds
=
new
PagedDataSource();
Pds.DataSource
=
Ds.Tables[
0
].DefaultView;
Pds.AllowPaging
=
true
;
Pds.PageSize
=
6
;
this
.DataList1.DataSource
=
Pds;
this
.DataList1.DataBind();
Conn.Close();
}
//
下一页
protected
void
LinkButton2_Click(
object
sender, EventArgs e)
...
{
Pds.CurrentPageIndex
++
;
this
.DataList1.DataSource
=
Pds;
this
.DataList1.DataBind();
}
//
上一页
protected
void
LinkButton1_Click(
object
sender, EventArgs e)
...
{
Pds.CurrentPageIndex
--
;
this
.DataList1.DataSource
=
Pds;
this
.DataList1.DataBind();
}
}
posted @ 2008-04-01 21:46
LuckStar
阅读(26)
评论(0)
编辑
收藏
网摘
新用户注册
刷新评论列表
标题
姓名
主页
Email
(博主才能看到)
验证码
*
看不清,换一张
[
登录
][
注册
]
内容(请不要发表任何与政治相关的内容)
网站首页
新闻频道
社区
小组
博问
网摘
人才
找找看
Remember Me?
登录
使用高级评论
新用户注册
返回页首
恢复上次提交
[使用Ctrl+Enter键可以直接提交]
Google站内搜索
相关文章:
相关链接:
最新IT新闻:
Google操作系统已开始内部测试?
Google阅读器界面升级 全新改版
微软官方下载:Windows Vista SP2 Beta测试版
微软发布PC Live单机游戏客户端
Firefox遭“独家”恶意软件攻击
<
2008年4月
>
日
一
二
三
四
五
六
30
31
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
1
2
3
4
5
6
7
8
9
10
与我联系
发短消息
搜索
常用链接
我的随笔
我的空间
我的短信
我的评论
更多链接
我的参与
我的新闻
最新评论
我的标签
留言簿
给我留言
查看留言
我参加的小组
ASP.NET
我的标签
asp(1)
cookies(1)
随笔档案
2008年8月 (2)
2008年4月 (7)
2008年3月 (3)
文章分类
asp
(rss)
asp.net(2)
(rss)
atlas
(rss)
最新评论
阅读排行榜
1. asp设置cookies过期时间(684)
2. 使用xsl样式表无法查看xml输入(595)
3. [SQL 2000]发生错误1069:由于登录失败而无法启动服务(385)
4. DataList动态添加模版(108)
5. SCOPE_IDENTITY、IDENT_CURRENT 和 @@IDENTITY的比较(76)
评论排行榜
1. [SQL 2000]发生错误1069:由于登录失败而无法启动服务(6)
2. asp.net url Rewriting總結(2)
3. asp设置cookies过期时间(1)
4. 设置网站图标(0)
5. 使用xsl样式表无法查看xml输入(0)