kamagra how much to take

Telerik RadGridView – Updating DataTemplate For GridViewImageColumn

This is a quick tip for people doing Silverlight development with the Telerik control set. Particuarlly if you are using the RadGridView.

If you are updating a GridViewImageColumn, a lot of the examples out there say to set the GridViewCellBase.ContentTemplate by indexing on the cell collection. Don’t do this. It appears to arbitrarly updated other columns. Even when they are the wrong column type which is random. So if you are doing this:

GridViewRowItem xGridViewRow = RadGridView.CurrentCell.ParentRow;
GridViewCellBase cell = xGridViewRow.Cells[1];
cell.ContentTemplate = “Selecting Some DataTemplate”;           

Iterate the cell collection instead and test whatever; header, type, really whatever you want. It’s more consistent. For example, to test the column type:

GridViewRowItem xGridViewRow = RadGridView.CurrentCell.ParentRow;
foreach (GridViewCellBase x in xGridViewRow.Cells.Where(x => x.Column is GridViewImageColumn))
x.ContentTemplate = “Selecting Some DataTemplate”;    



Leave a Reply

Your email address will not be published. Required fields are marked *