带分页和复选框的Gridview [英] Gridview with paging and checkbox

查看:69
本文介绍了带分页和复选框的Gridview的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好,

我有一个启用分页的gridview.并且第一列是网格的复选框.我每页显示10条记录.(假设总共有100条记录),但是当我在gridview复选框的标题中选择时,我需要选择所有记录(100条记录).任何人都可以提供示例代码吗?

Hi All,

I have a gridview with paging enabled. and also first column is checkbox for the grid. i am displaying 10 records per page.(assume there are totally 100 records) but when i select at header of the gridview checkbox i need to select all the records(100 records). can any one please provide sample code for that?

推荐答案

其余的记录未加载到控件中,所以我想您需要检查它" s在代码后面签入,并以编程方式标记它们都被选中.
The rest of your records are not loaded into the control, so I guess you need to check that it''s checked in your code behind, and programatically mark that they are all selected as a result.


您需要在表中添加具有数据类型位的AllCheck字段.

当您选择标题处的复选框时,请在gridview的itemdatabound命令中编写代码,以使表中的AllCheck字段变为1.

由于Allcheckfield变为1,因此即使您在gridview中每页显示10条记录,所有复选框也会被选中(您也需要为此编写代码).

您将通过搜索Google来找到代码,只需尝试一下即可...:)
You need to add a field AllCheck with datatype bit in the table.

When you select checkbox at the header write code in the itemdatabound command of gridview so that AllCheck field in the table will become 1.

As Allcheckfield become 1 all checkbox get selected(u need to write code for this also) even if you are displaying 10 recs per page in gridview.

you ll find the code by searching google just try it... :)


是的,肯定是

Yes, Definately

Click Here

This would definately help with those fundas.

Thanks,
Hiren Solanki
{Mark as A Answer if it helps }


这篇关于带分页和复选框的Gridview的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆