This is a migrated thread and some comments may be shown as answers.

[Solved] Gridclientselect column

3 Answers 160 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Ayesha
Top achievements
Rank 1
Ayesha asked on 09 Nov 2009, 10:53 PM
Hi,

I've a radgrid with gridclient select column.

I've paging turned on with pagesize 10.
My question is

1) when I select 2 items in first page and travel to next page and selct further 2 items, and click on delete , only the records from the second page gets deleted.
But I selected 2 records from first page too. so, how do I even make all items selcted across pages delted.
I don't want to select 2 records from 1 page, delete , then go to next page and again delete.
I want to select all items by checking the check box and delete should delete all the items selected across pages.
Pls help me with code samples in C#.

Thanks,
ZR

3 Answers, 1 is accepted

Sort by
0
Princy
Top achievements
Rank 2
answered on 10 Nov 2009, 05:45 AM
Hello Zaheka,

The client-side selection in RadGrid is handled on a per-page basis. If you would want to persist the selection throughout the pages in your grid, probably you can refer to the followinghelp documents:
Persisting the selected rows client-side on sorting/paging/filtering/grouping
Persisting the selected rows server-side on sorting/paging/filtering/grouping

  While deleting you can disable temporarily the paging of the grid by setting the AllowPaging property of the grid to false and rebind the control invoking its Rebind() method, then traverse all items in it. Now perform the delete operation and then set the AllowPaging property back to true and rebind the grid to enable the paging feature again. Or you can also loop through the pages in the grid and delete the selected rows.

Hope this helps..
Princy.
0
Ayesha
Top achievements
Rank 1
answered on 30 Nov 2009, 10:15 PM
How do we loop through the pages in the grid and delete the selected rows.?
0
Ayesha
Top achievements
Rank 1
answered on 30 Nov 2009, 10:43 PM
Hi,

In my grid, I need to select 2 items from 1st page and then I travel to the next page and select 3 items and I've a OK button which actually needs to take all 5 items from these 2 pages and save it. how do i do this. 


ArrayList selectedItems;
 if (Session["selectedItems"] == null)
 {
    selectedItems =
new ArrayList();
 }
 
else
 {
   
selectedItems = (ArrayList)Session["selectedItems"];
 }

//what needs to be done for the below line.radgrid.PageCommandName
and should I change e.Item is gridPagerItem. Pls do help me with code


 
if (e.CommandName == RadGrid.SelectCommandName && 
     e.Item
is GridDataItem)
 {
   GridDataItem dataItem = (GridDataItem)e.Item;
   
string customerID = dataItem.OwnerTableView.DataKeyValues[dataItem.ItemIndex]["CustomerID"].ToString();
   selectedItems.Add(customerID);
   Session[
"selectedItems"] = selectedItems;
 }
Tags
Grid
Asked by
Ayesha
Top achievements
Rank 1
Answers by
Princy
Top achievements
Rank 2
Ayesha
Top achievements
Rank 1
Share this question
or