最新下载
热门教程
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
- 10
Asp.NET 的aspnetpager分页代码
时间:2022-06-25 05:06:17 编辑:袖梨 来源:一聚教程网
asp教程.net 的aspnetpager分页代码
@ page language="c#" autoeventwireup="true" codefile="default.aspx.cs" inherits="test_default" stylesheettheme="default" %>
<%...@ register assembly="aspnetpager" namespace="wuqi.webdiyer" tagprefix="webdiyer" %>
<%
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;
using cpp114.tools.oledb;
using system.data.oledb;
using wuqi.webdiyer;public partial class test_default : system.web.ui.page
...{
protected oledbconnection conn = new oledbconnection();
protected oledbcommand cmd = new oledbcommand();protected void page_load(object sender, eventargs e)
...{
if (!ispostback) ...{
initdb();
conn.open();
cmd.commandtext = "select count(*) from t_product";
pager1.recordcount = (int)cmd.executescalar();
conn.close();
binddata();
}}
//初始化连接对象
protected void initdb()...{
conn.connectionstring = oledbtool.myconnstr + server.mappath(oledbtool.mydbname);
cmd.connection = conn;
}
//数据绑定
protected void binddata() ...{
initdb();
oledbdataadapter sda = new oledbdataadapter("select * from t_product",conn);
dataset ds = new dataset();
//sda.fill(ds, 10, 10, "temptbl");
sda.fill(ds, pager1.pagesize * (pager1.currentpageindex - 1), pager1.pagesize, "temptbl");
datalist1.datasource = ds.tables["temptbl"];
datalist1.databind();
}
//翻页事件
protected void changepage(object src, pagechangedeventargs e)
...{
pager1.currentpageindex = e.newpageindex;
binddata();
}}
相关文章
- 密室逃脱21遗落梦境有什么通关技巧 08-26
- 天涯明月刀逍遥蹴鞠怎么玩 08-26
- 大侠立志传内力怎么增加-增加内力方法 08-26
- 为了吾王猎人如何配置装备 08-26
- 漫画群星大集结黑崎一护有什么玩法技巧 08-26
- 赛尔号巅峰之战星际招募怎么玩 08-26