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

Color cell at anytime

2 Answers 34 Views
GridView
This is a migrated thread and some comments may be shown as answers.
Jeff
Top achievements
Rank 1
Jeff asked on 18 Mar 2010, 05:47 PM
Hi,

I would like to change the background of a cell at anytime.
For example, when a user click on a button, it colors a cell on a loaded grid.
I know the coordonates of the cell.

I tried to get throw the "ItemContainerGenerator" but I can't get all displayed cells.

How can I achieve that ?

Thanks,

Jeff

2 Answers, 1 is accepted

Sort by
0
Milan
Telerik team
answered on 19 Mar 2010, 07:45 AM
Hi JF Carré,

By default RadGridView used virtualization to boost performance and is some situations, like yours, this could pose a problem since just a small amount of UI elements will be created. By turning off the  selection mechanism you should be able to get any UI element on the grid:

    this.playersGrid.EnableColumnVirtualization = false;
    this.playersGrid.EnableRowVirtualization = false;
}
  
public GridViewCell GetCell(int rowIndex, int columnIndex)
{
    var row = this.playersGrid.ItemContainerGenerator.ContainerFromIndex(rowIndex) as GridViewRow;
    var cell = row.Cells[columnIndex] as GridViewCell;
  
    return cell;
}


Sincerely yours,
Milan
the Telerik team

Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.
0
Jeff
Top achievements
Rank 1
answered on 19 Mar 2010, 10:16 AM
Thanks,

it works very well,

Jeff
Tags
GridView
Asked by
Jeff
Top achievements
Rank 1
Answers by
Milan
Telerik team
Jeff
Top achievements
Rank 1
Share this question
or