asp:ObjectDataSource+asp:GridView 实现真分页
<asp:GridView
ID="GridViewCacheManager"
DataSourceID="OdsCacheManager"
runat="server"
Width="100%"
CssClass="datable"
border=""
CellPadding=""
OnRowDataBound="GridViewCacheManager_RowDataBound"
OnRowCommand="GridViewCacheManager_RowCommand"
AutoGenerateColumns="False"
AllowPaging="True"
PageSize=""
AllowSorting="True" EnableModelValidation="True" ForeColor="#333333" GridLines="None"> <PagerSettings Visible="False" />
<PagerStyle BackColor="#2461BF" ForeColor="White" HorizontalAlign="Left" />
<RowStyle CssClass="lupbai" BackColor="#EFF3FB" HorizontalAlign="Center" />
<HeaderStyle CssClass="lup" BackColor="#b6c9e7" Font-Bold="True" ForeColor="White" />
<EditRowStyle BackColor="#2461BF" />
<FooterStyle BackColor="#507CD1" Font-Bold="True" ForeColor="White" />
<AlternatingRowStyle CssClass="trnei" BackColor="White" />
<Columns> <asp:TemplateField HeaderText="选择">
<HeaderStyle Width="40px" />
<ItemTemplate>
<asp:CheckBox ID="CheckBox1" runat="server" />
</ItemTemplate>
</asp:TemplateField> <asp:BoundField DataField="Title" HeaderText="标题">
<HeaderStyle Width="250px" />
</asp:BoundField> <asp:BoundField DataField="Views" HeaderText="浏览">
<HeaderStyle Width="50px" />
</asp:BoundField> <asp:BoundField DataField="Shares" HeaderText="收藏">
<HeaderStyle Width="50px" />
</asp:BoundField> <asp:BoundField DataField="Status" HeaderText="状态">
<HeaderStyle Width="50px" />
</asp:BoundField> <asp:BoundField DataField="AddTime" HeaderText="发表时间" DataFormatString="{0:yyyy-MM-dd HH:mm}" HtmlEncode="false">
<HeaderStyle Width="80px" />
</asp:BoundField> <asp:BoundField DataField="EditTime" HeaderText="编辑时间" DataFormatString="{0:yyyy-MM-dd HH:mm}" HtmlEncode="false">
<HeaderStyle Width="80px" />
</asp:BoundField> <asp:TemplateField HeaderText="常规操作">
<ItemTemplate>
<asp:LinkButton ID="lbtnview" runat="server" PostBackUrl="">查看</asp:LinkButton>
</ItemTemplate>
<HeaderStyle Width="120px" />
</asp:TemplateField> </Columns>
<SelectedRowStyle BackColor="#D1DDF1" Font-Bold="True" ForeColor="#333333" />
</asp:GridView> <asp:ObjectDataSource
ID="OdsCacheManager"
runat="server"
SelectMethod="SelectAllToTable"
TypeName="Data.ArticleDao"
EnablePaging="false"
StartRowIndexParameterName="startRowIndex"
MaximumRowsParameterName="maxRows"
SelectCountMethod="GetCount"> <SelectParameters>
<%--<asp:ControlParameter Name="type" ControlID="hiddenFiledType" PropertyName="value" />
<asp:ControlParameter Name="userID" ControlID="hiddenFiledUserID" PropertyName="value" /> --%>
</SelectParameters> </asp:ObjectDataSource> <asp:HiddenField ID="hiddenFiledUserID" runat="server" Value="" />
<asp:HiddenField ID="hiddenFiledType" runat="server" Value="" />
protected void GridViewCacheManager_RowCommand(object sender, GridViewCommandEventArgs e)
{
int ID = Convert.ToInt32(e.CommandArgument);
if (e.CommandName == "Del")
{
// bool isSuccess = UserDao.DeleteUserByID(ID);
}
} protected void GridViewCacheManager_RowDataBound(object sender, GridViewRowEventArgs e)
{ }
public static DataTable SelectAllToTable()
{
return result;
}
asp:ObjectDataSource+asp:GridView 实现真分页的更多相关文章
- Asp.Net北大青鸟总结(四)-使用GridView实现真假分页
这段时间看完了asp.net视频.可是感觉到自己的学习好像没有巩固好,于是又在图书馆里借了几本关于asp.net的书感觉真的非常好自己大概对于asp.net可以实现主要的小Demo.可是我知道仅仅有真 ...
- ASP.NET 为GridView添加序号列,且支持分页连续累计显示
为GridView添加序号列,且支持分页连续累计显示,废话不多说,直接上代码: <%@ Page Language="C#" AutoEventWireup="tr ...
- Asp.Net:GridView 编辑、删除、自定义分页以后备用
页面 GridView 绑定:在中,有 <asp:BoundField/>和 <asp:TemplateField><ItemTemplate>嵌套服务器控件 &l ...
- ASP.NET真分页_接前篇引用AspNetPager.dll进行数据分页
一.前端准备工作 1.之前我写到过<Asp.net中引用AspNetPager.dll进行数据分页> 这种分页方式只能在前台将数据分页,而每次点击查询时对目标数据库还是全查询,这样不仅会 ...
- ASP.NET真假分页—真分页
当数据量过大,有几万甚至十几万条数据时,每次都从数据库中取出所有数据就会降低查询效率,系统运行慢,还有可能卡死,这时假分页就会显得很不人性化,因此有了真分页的必要性. 正如上篇博文总结归纳,“真”相对 ...
- Asp.Net真分页技术
最近学校要做课题,闲来没事研究了下Asp.net的分页,我使用Repeater进行数据的绑定,每次从数据库读取到8条数据填充到Repeater中,这样搞可以降低数据库的压力,提高效率. 效果图如下: ...
- ASP.NET(五):ASP.net实现真分页显示数据
导读:在上篇文章中,介绍了用假分页实现数据的分页显示 ,而避免了去拖动滚动条.但,假分页在分页的同时,其实是拖垮了查询效率的.每一次分页都得重新查询一遍数据,那么有没有方法可以同时兼顾效率和分页呢,那 ...
- [小技巧]让你的GridView支持IQueryable,并自动实现真分页
众所周知,asp.net自带的GridView在自带分页方面设计得很2,因为它是假分页,即内存分页.而且它不智能支持强大的Iqueryable. 但这表明微软忽略了现实中的分页需求吗?答案应该不是,我 ...
- Asp.net中GridView详解《转》
ASP.NET服务器控件GridView 1 ASP.NET 服务器控件GridView使用 本教程不介绍服务器端控件的呈现,事件处理,状态等理论知识,只介绍服务器端控件的使用操作,如 ...
随机推荐
- iOS开发调试篇—Print Description of "string"
Print Description of "string":把 string 的信息输出到控制台.Copy:复制 string 的信息,包含变量名,类名和值.View Value ...
- Oracle学习笔记(6)——函数
函数的作用 方便数据的统计 处理查询结果 函数的分类 Oracle内置的系统函数 数值函数 四舍五入 ROUND ...
- CRF++地名实体识别(特征为词性和词)
http://x-algo.cn/index.php/2016/02/29/crf-name-entity-recognition/ 类似使用CRF实现分词和词性标注,地域识别也是需要生成相应的tag ...
- MySQL老是提示视图没有主键
写了一个视图,每次打开都提示没有主键.我又不想更新视图,根本不关心这个,但每次都提示,很烦. 网上找到解决办法,就是关闭提示: Windows 和 Linux:选择工具 > 选项,并在外观 &g ...
- [PureScript] Introduce to PureScript Specify Function Arguments
JavaScript does its error-checking at runtime, but PureScript has a compiler, which makes sure that ...
- [Git] Squash all of my commits into a single one and merge into master
Often you have your feature branch you’ve been working on and once it’s ready, you just want it to m ...
- C# 动态解析表达式
需求 我们很难捉摸用户的思维,即使使用非常正式的文档规范某些数据的定义.结果的标准等,也不能抵挡住用户不断变化的需求,但他们有个万变不离的东西——你做这个东西要是万能的,即输入参数类型.个数等发生改变 ...
- How to check WWN and Multipathing on Windows Server
There are many ways to find the World Wide Name (WWN) of fibre channel HBA connected to windows serv ...
- JAVA调用SHELL事例
以往一直都是crontab+shell调用java程序,最近需要反过来,使用java调用shell程序,实现定时管理,今天总结一下. 基础内容: java的java.lang.Runtime类提供了e ...
- 算法笔记_200:第三届蓝桥杯软件类决赛真题(C语言本科)
目录 1 星期几 2 数据压缩 3 拼音字母 4 DNA比对 5 方块填数 前言:以下代码部分仅供参考,若有不当之处,还望路过同学指出哦~ 1 星期几 1949年的国庆节(10月1日)是星期六. ...