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

Filtering checkbox column

1 Answer 113 Views
GridView
This is a migrated thread and some comments may be shown as answers.
jerry
Top achievements
Rank 1
jerry asked on 25 Mar 2009, 03:36 PM
I have a column that is defined as GridViewCheckBoxColumn  I'm able to check the checkboxes and the code behind does what it's suppose to do.  My problem is when I filter another column the checked rows stay checked but the data for that row has changed.  When I try and do it programmically every time I do the following

this.radGVTables.Rows[i].IsSelected = false;   
The  radGVTables_ValueChanged event fires and it is looking for the rowindex.  
But since it was the filter that was selected the rowindex is -1.    
 
1. Is there a way to change the rowindex or cycle through the rows?   
2. Is there a way to clear out all the checked checkboxes?  
3. How have others handled Checkboxes and Filters?  
 
Thank You  
Jerry  
 



 
 
 

1 Answer, 1 is accepted

Sort by
0
Jack
Telerik team
answered on 25 Mar 2009, 04:21 PM
Hello jerry,

Thank you for contacting us.

I am not sure if I understand the issue correctly. Could you please send us a sample application that reproduces the issue and give us more details on the behavior you want to achieve.

Regarding your questions:

1. The RowIndex property is the actual index of any data row in the Rows collection of RadGridView. It contains only data rows, so when a filter or "add new row" row is selected, the index is -1. You can't change this index. To iterate over the rows use the following code:

foreach (GridViewDataRowInfo row in this.radGridView1.Rows) 
    //... 
 

2. You could just iterate over the Rows collection and set the Value property for the desired cells.

this.radGridView1.GridElement.BeginUpdate(); 
foreach (GridViewDataRowInfo row in this.radGridView1.Rows) 
    row.Cells["checkbox"].Value = false
this.radGridView1.GridElement.EndUpdate(); 

3. In general this is an automated process and you shouldn't do anything. It can indicate some potential issue. So please, send us your application so we can test it and locate the issue.

I am looking forward to your reply.

Regards,
Jack
the Telerik team

Check out Telerik Trainer , the state of the art learning tool for Telerik products.
Tags
GridView
Asked by
jerry
Top achievements
Rank 1
Answers by
Jack
Telerik team
Share this question
or