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:

  1. GridViewRowItem xGridViewRow = RadGridView.CurrentCell.ParentRow;
  2. GridViewCellBase cell = xGridViewRow.Cells[1];
  3. 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:

  1. GridViewRowItem xGridViewRow = RadGridView.CurrentCell.ParentRow;
  2. foreach (GridViewCellBase x in xGridViewRow.Cells.Where(x => x.Column is GridViewImageColumn))
  3. {
  4. x.ContentTemplate = "Selecting Some DataTemplate";    
  5. }

 

share save 171 16 Telerik RadGridView   Updating DataTemplate For GridViewImageColumn

Leave a Reply

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

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>