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

Get row in DataLoaded event

2 Answers 71 Views
GridView
This is a migrated thread and some comments may be shown as answers.
trinh
Top achievements
Rank 1
trinh asked on 20 Mar 2013, 11:00 AM
How to parse all rows of grid in DataLoaded event?
I used GetRowForItem function but it always return null

2 Answers, 1 is accepted

Sort by
0
Dimitrina
Telerik team
answered on 20 Mar 2013, 11:38 AM
Hello,

In general, I would not recommend working with visual elements. May I ask you to share why do you need to parse all the rows of grid in DataLoaded event?

Regards,
Didie
the Telerik team

Explore the entire Telerik portfolio by downloading Telerik DevCraft Ultimate.

0
trinh
Top achievements
Rank 1
answered on 21 Mar 2013, 01:36 AM
Hi,

In my application, i need change cell foreground based on value of another cell in same row. So, i set it in RowLoaded event.
I debug and the change cell foreground is ok but it is not change in interface.

In interface, the new foreground is not changed. But when i scroll --> it is applied.

I also use CellTemplate in my grid. 
The code to change cell foreground color in RowLoaded event:
foreach (GridViewCell cell in e.Row.Cells)
                {                    
                    if (cell.Content is CellContentPresenter)
                    {                        
                        myCustomControl item = ((CellContentPresenter)cell.Content).FindChildByType<myCustomControl>();
                        if (item != null)
                        {
                            item.Foreground = newForeground;
                        }                        
                    }                    
                }

myCustomControl is a custom control based on Textbox.

Note: This bug is not appeared in previous version of telerik control (version in 2012). It is just appeared after i upgrade telerik control to version 2013.1.220

Thank to help me!
Tags
GridView
Asked by
trinh
Top achievements
Rank 1
Answers by
Dimitrina
Telerik team
trinh
Top achievements
Rank 1
Share this question
or