Hi team:
I have a grid and with check box every row,now I checked the column checkbox it only select from the current page that is the 1st page,If there are more then one page the user has to go to each page and do select all. Can you give a demo ,thanks !
tommy.
I have a grid and with check box every row,now I checked the column checkbox it only select from the current page that is the 1st page,If there are more then one page the user has to go to each page and do select all. Can you give a demo ,thanks !
tommy.
5 Answers, 1 is accepted
0
Hi Tommy,
When the grid is in paging mode only the items for the current page are retrieved - there are no items in memory.
Additionally If you want to operate with all records from the source when the grid paging is enabled, reference directly the data from the underlying data source to process further operations over it.
The other solution is to disable temporary the paging feature of the control.
You have to set the AllowPaging property of the grid to false at a certain stage of the lifecycle and rebind the control invoking its Rebind() method, then traverse all items in it. When you are done with this task, set the AllowPaging property back to true and rebind the grid to enable the paging feature again.
Additionally, in order to persist the selection across different grid pages, consider the solution presented in this section of the online documentation:
http://www.telerik.com/help/aspnet-ajax/grdpersistselectedrowsonsorting.html
Regards,
Pavlina
the Telerik team
Check out Telerik Trainer , the state of the art learning tool for Telerik products.
When the grid is in paging mode only the items for the current page are retrieved - there are no items in memory.
Additionally If you want to operate with all records from the source when the grid paging is enabled, reference directly the data from the underlying data source to process further operations over it.
The other solution is to disable temporary the paging feature of the control.
You have to set the AllowPaging property of the grid to false at a certain stage of the lifecycle and rebind the control invoking its Rebind() method, then traverse all items in it. When you are done with this task, set the AllowPaging property back to true and rebind the grid to enable the paging feature again.
Additionally, in order to persist the selection across different grid pages, consider the solution presented in this section of the online documentation:
http://www.telerik.com/help/aspnet-ajax/grdpersistselectedrowsonsorting.html
Regards,
Pavlina
the Telerik team
Check out Telerik Trainer , the state of the art learning tool for Telerik products.
0
Tommy
Top achievements
Rank 1
answered on 15 Apr 2009, 02:09 AM
thanks for your answer
0
Tommy
Top achievements
Rank 1
answered on 15 Apr 2009, 03:26 AM
By the way
How to get the check box control in the column.After change the page index , the column check box status will be change from checked to uncheck ,I try to use findcontrol function,but is failed. Following is my code.
Asp Code
C# code
"cb1" and "cb2" are both nullable value.
Can you give me a hand to deal with this problem.
Thanks very much again!
Tommy
How to get the check box control in the column.After change the page index , the column check box status will be change from checked to uncheck ,I try to use findcontrol function,but is failed. Following is my code.
Asp Code
| <telerik:GridTemplateColumn UniqueName="CheckBoxTemplateColumn"> <HeaderTemplate> <asp:CheckBox ID="headerChkbox" OnCheckedChanged="DistToggleSelectedState" AutoPostBack="True" runat="server"> </asp:CheckBox> </HeaderTemplate> <ItemTemplate> <asp:CheckBox ID="CheckBox1" OnCheckedChanged="DistToggleRowSelection" AutoPostBack="True"runat="server"></asp:CheckBox> </ItemTemplate> </telerik:GridTemplateColumn> |
C# code
| System.Web.UI.WebControls.CheckBox cb1 =RadGrid.HeaderContextMenu.FindControl("headerChkbox") as System.Web.UI.WebControls.CheckBox;System.Web.UI.WebControls.CheckBox cb2 =RadGrid.FindControl("headerChkbox") as System.Web.UI.WebControls.CheckBox; |
"cb1" and "cb2" are both nullable value.
Can you give me a hand to deal with this problem.
Thanks very much again!
Tommy
0
Accepted
Princy
Top achievements
Rank 2
answered on 15 Apr 2009, 07:46 AM
Hello Tommy,
You can access the checkbox in the HeaderTemplate of the TemplateColumn as shown below:
c#:
Thanks
Princy.
You can access the checkbox in the HeaderTemplate of the TemplateColumn as shown below:
c#:
| protected void RadGrid_ItemDataBound(object sender, GridItemEventArgs e) |
| { |
| if (e.Item is GridHeaderItem) |
| { |
| GridHeaderItem header = (GridHeaderItem)e.Item; |
| CheckBox checkbox = (CheckBox)header.FindControl("headerChkbox"); |
| } |
| } |
Thanks
Princy.
0
Tommy
Top achievements
Rank 1
answered on 15 Apr 2009, 09:35 AM
Thanks again for the professional answer.