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

How to get all row with checkboxcolumn checked

1 Answer 993 Views
GridView
This is a migrated thread and some comments may be shown as answers.
Hans
Top achievements
Rank 1
Hans asked on 09 Dec 2014, 06:49 PM
How I can loop through all row of my grid and detect only row with checkbox column checked ?

1 Answer, 1 is accepted

Sort by
0
Hristo
Telerik team
answered on 10 Dec 2014, 05:15 PM
Hello Hans,

Thank you for contacting us.

You can iterate the ChildRows collection of your grid and access each row as a GridViewRowInfo object. Then you only have to check for the value of  your checkbox column. The code snippet below should help:
IList<GridViewRowInfo> gridRows = new List<GridViewRowInfo>();
foreach (GridViewRowInfo rowInfo in radGridView.ChildRows)
{
    bool isChecked = (bool)rowInfo.Cells["CheckboxColumn"].Value;
    if (isChecked == true)
    {
        gridRows.Add(rowInfo);
    }
}

Should you have further questions please do not hesitate to contact us.

Regards,
Hristo
Telerik
 

Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.

 
Tags
GridView
Asked by
Hans
Top achievements
Rank 1
Answers by
Hristo
Telerik team
Share this question
or