How to parse all rows of grid in DataLoaded event?
I used GetRowForItem function but it always return null
2 Answers, 1 is accepted
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?
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