ListView + DataPager
来源:互联网 发布:淘宝上的天王表旗舰店 编辑:程序博客网 时间:2024/05/20 21:58
ListView、DataPager与LinqDataSource一起使用没问题,
不过当你不使用LinqDataSource的时候会发生一个小问题,就是当你在第一次点选DataPager
中的页码时并不会跟着跳页,而点选第二次的时候才会正常运作!所谓的「不使用LinqDataSource
的时候」是指你的资料来源的取得可能是写在Code Behind中或是使用ObjectDataSource或
SqlDataSource控制项,例如:所谓的「不使用LinqDataSource的时候」是指你的资料来源的取
得可能是写在Code Behind中或是使用ObjectDataSource或SqlDataSource控制项,例如:
protected void Page_Load( object sender, EventArgs e) protected void Page_Load( object sender, EventArgs e)
{
var q = from p in db.News select p; var q = from p in db.News select p;
ListView2.DataSource = q; ListView2.DataSource = q;
ListView2.DataBind();
}
要解决这个问题必须要在ListView控制项宣告OnPagePropertiesChanging个事件,并执行该DataPager的
SetPageProperties方法,范例程式如下:要解决这个问题必须要在ListView控制项宣告
OnPagePropertiesChanging个事件,并执行该DataPager的SetPageProperties方法,范例程式如下:
protected void Page_Init( object sender, EventArgs e)
{
ListView2.PagePropertiesChanging += ListView2.PagePropertiesChanging +=
new EventHandler<PagePropertiesChangingEventArgs>(ListView2_PagePropertiesChanging); new EventHandler<PagePropertiesChangingEventArgs>(ListView2_PagePropertiesChanging);
}
void ListView2_PagePropertiesChanging( object sender, PagePropertiesChangingEventArgs e) void ListView2_PagePropertiesChanging( object sender, PagePropertiesChangingEventArgs e)
{
ListView srcListView = sender as ListView; ListView srcListView = sender as ListView;
this .DataPager1.SetPageProperties(e.StartRowIndex, e.MaximumRows, false); this .DataPager1.SetPageProperties(e.StartRowIndex, e.MaximumRows, false);
srcListView.DataBind();
}
转自http://www.cnblogs.com/kingjiong/archive/2008/10/16/1312395.html
- ListView + DataPager
- ListView + DataPager 分页查询
- ListView +ObjectDataSource+DataPager
- DataPager和ListView 的关系
- DataPager
- ListView控件和DataPager控件配合方法
- ListView控件与DataPager控件详解
- ListView搭配DataPager控件实现分页--笔记
- 用DataPager与ListView实现分页。
- Asp.Net ListView+DataPager 的使用
- (转)ASP.NET 3.5中的ListView控件和DataPager控件
- ListView控件与DataPager控件详解(1)
- ASP.NET 3.5中的ListView控件和DataPager控件
- Building Custom Paging with LINQ, ListView, DataPager and ObjectDataSource
- 利用ListView和DataPager控件来对数据分页
- ASP.NET 3.5中的ListView控件和DataPager控件
- [翻译]ASP.NET 3.5中的ListView控件和DataPager控件
- .net3.5正统分页控件来了(ListView和DataPager)
- Web性能优化宝典
- 广度优先遍历求解 ZOJ 649 (Rescue)
- mount 命令
- 如何使用Beyond Compare软件进行代码比对
- php远程copy以及执行命令
- ListView + DataPager
- xcode build error ...
- opencv 矩阵相乘, matlab矩阵相乘,以及自己写的矩阵相乘的时间比较
- 自动生成makefile的工具?GNU Automake;cmake;
- keyword not supported data source 问题解决办法
- Java(Android)对文件全文生成MD5摘要
- 短地址转换原理
- [Mklink,Junction,Icacls] 利用批处理生成用户配置文件中的 Junction
- 实现文件夹创建的C子函数并有详解