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

loop to the gridview rows

1 Answer 312 Views
GridView
This is a migrated thread and some comments may be shown as answers.
sarag
Top achievements
Rank 1
sarag asked on 09 Feb 2011, 10:01 PM
Hi,
i am using RadGridView  i have a toggle button in one of the grid column, my question is when window loaded i need to set the togglebutton.ischecked to true,  when i am trying to loop to the grid i am getting only the first page rows, how can i get all the grid rows.
i have 200 records

 IList<GridViewRow> rows = radGridView.ChildrenOfType<GridViewRow>();
            foreach (GridViewRow row in rows)
            {
                if (!(row is GridViewNewRow) && !(row is GridViewHeaderRow))
                {
                    GridViewToggleButton toggleButton = row.Cells[0].ChildrenOfType<GridViewToggleButton>().FirstOrDefault();
                    if (toggleButton != null )
                    {
                        toggleButton.IsChecked = true;
                    }
                }
            }

thanks
sarag.

1 Answer, 1 is accepted

Sort by
0
Maya
Telerik team
answered on 10 Feb 2011, 08:47 AM
Hi sarag,

The recommended approach would be to expose a new boolean property in your business object and bind it to the IsChecked property of the ToggleButton. Thus you will be able easily to run through the Items collection of the grid and set this property to "False" for each item. 

Regards,
Maya
the Telerik team
Let us know about your Windows Phone 7 application built with RadControls and we will help you promote it. Learn more>>
Tags
GridView
Asked by
sarag
Top achievements
Rank 1
Answers by
Maya
Telerik team
Share this question
or