GridView 的DropDownList分页实现
来源:互联网 发布:java 执行dos命令 编辑:程序博客网 时间:2024/05/19 20:42
<asp:TemplateField HeaderText="选择下载">
<ItemTemplate>
<asp:CheckBox runat="server" ID="checked" Checked="false"/>
</ItemTemplate>
</asp:TemplateField>
1.说明:数据列绑定,将GridView增加一个新的列
2.PagerTemplate模板的分页实现:
可以先设计好一个DIV的层:层包括分页按钮,分页显示,DropDownList跳转到第几页
然后放在:PagerTemplate中,
<div style="text-align:left">
<asp:LinkButton ID="FirstPage" runat="server" Text="首页"
ForeColor="#FFFAAA"
Enabled="<%# ((GridView)Container.Parent.Parent).PageIndex!=0 %>"
CommandArgument="First" CommandName="Page" />
<asp:LinkButton ID="PuPage" runat="server" Text="上一页"
CommandArgument="Prev" CommandName="Page" ForeColor="#FFFAAA"
Enabled="<%# ((GridView)Container.Parent.Parent).PageIndex!=0 %>" />
第<asp:Label ID="PageIndex" Text="<%# ((GridView)Container.Parent.Parent).PageIndex+1%>" ForeColor="#FFFAAA" runat="server" />页
/
共<asp:Label ID="Pages" Text="<%# ((GridView)Container.Parent.Parent).PageCount%>" ForeColor="#FFFAAA" runat="server" />页
<asp:LinkButton ID="NextPage" runat="server" Text="下一页" ForeColor="#FFFAAA"
Enabled="<%# ((GridView)Container.Parent.Parent).PageIndex!=((GridView)Container.Parent.Parent).PageCount-1%>"
CommandArgument="Next" CommandName="Page" />
<asp:LinkButton ID="LastPage" runat="server" Text="尾页" ForeColor="#FFFAAA"
Enabled="<%# ((GridView)Container.Parent.Parent).PageIndex!=((GridView)Container.Parent.Parent).PageCount-1%>"
CommandArgument="Last" CommandName="Page" />
<asp:CheckBox runat="server" ForeColor="#FFFAAA" ID="checkAll" Text="全选" />
<asp:LinkButton runat="server" ForeColor="#FFFAAA" ID="LoadDownAll" Text="全部下载" />
</div>
绑定说明:
CommandArgument="Prev" CommandName="Page" 相关命令参数,Prev
相关命令:Page
Enabled="<%# ((GridView)Container.Parent.Parent).PageIndex!=0 %>"//指定页不等于零:显示首页和上一页
Enabled="<%# ((GridView)Container.Parent.Parent).PageIndex!=((GridView)Container.Parent.Parent).PageCount-1%>"//显示下一页和尾
Enabled="<%# ((GridView)Container.Parent.Parent).PageIndex!=((GridView)Container.Parent.Parent).PageCount-1%>"//下一页和上一页的可用设置
CommandArgument="Next" CommandName="Page" />//下页命令参数
CommandArgument="Prev" CommandName="Page">//上一页命令参数
CommandArgument="First" CommandName="Page" />//首页命令参数
CommandArgument="Last" CommandName="Page" />//尾页命令参数
是否可用:
DropDownList:的数据绑定:
在GridView的RowDataBound事件中绑定
int page = this.gdvExercise.PageCount;//共有多少页
int indexPage = this.gdvExercise.PageIndex;//当前页
if (e.Row.RowType == DataControlRowType.Pager)
{
DropDownList myDropDownList = (DropDownList)e.Row.FindControl("GoPage");//找到DropDownList
for (int i = 1; i <= page; i++)
{
myDropDownList.Items.Add(i.ToString());//加到DropDownList中
myDropDownList.SelectedIndex = indexPage;//显示设置到当前页
}
}
DropDownList :的选择事件
DropDownList dr = (DropDownList)sender;
int page = int.Parse(dr.SelectedItem.Text);
this.gdvExercise.DataSource = exerciseBLL.SelectAllExercise();
this.gdvExercise.PageIndex = page-1;
this.gdvExercise.DataBind();
本文来自CSDN博客,转载请标明出处:http://blog.csdn.net/anzhiqiang_touzi/archive/2008/04/17/2299725.aspx
- GridView 的DropDownList分页实现
- GridView 的DropDownList分页实现
- GridView实现的分页
- GridView分页的实现
- GridView分页的实现
- GridView分页的实现
- 如何实现gridview里的dropdownlist
- gridview 里实现 DropDownList
- 关于Dropdownlist绑定GridView分页出错问题
- GridView下DropDownList 的选择方法onselectedindexchanged 实现方法
- GridView + DropDownList 实现 数据的 通过审查管理
- 关于DataList使用DropDownList的分页实现 技巧实例源码
- gridview中dropdownlist的赋值
- GridView中DropDownList的事件
- dropdownlist与gridview的关联
- GridView中DropDownList的应用
- ViewPager + GridView实现GridView分页
- asp.net2.0分页的实现(GridView)
- 在 Eclipse 中利用 Maven
- Linux下的C文件系统编程
- supply AK400 key Programmer
- ACE的安装
- 网址
- GridView 的DropDownList分页实现
- ACE源代码目录结构
- ubuntu自动mount
- WaitForSingleObject
- 单一世界架构初探之服务部署
- "没事,我来扛"
- How to overcome the issues of configuring condor
- Linux 网卡驱动安装 rpm包
- 使用ACE进行网络编程