We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date
close icon

Column Header Styles

Hi - We'd like to conditionally have an image in the column header of the GridDataBoundGrid. We tried creating a new GridBaseStyle, and setting its properties using Grid.BaseStylesMap, then applying the style to the header cell (as per the example on page 46 of gridug.pdf) but this doesn't seem to work. In particular, we want to be displaying (or not) an image in response to the user clicking in the header (as happens automatically when grid sorting is enabled). Thanks in advance - Ivan Pelly

3 Replies

AD Administrator Syncfusion Team November 18, 2002 05:14 PM UTC

The easiest way to draw an image in a header cell is to change the celltype from Header to Static. Static cells support drawing images by including teh ImageList and ImageIndex as part of the cell style. But Header celltype does not support the ImageList & ImageIndex drawing. If you want your header cells to have a different appearance than the default flat look, then set the style's Appearance property. You could try appropriately setting these properties in the CellClick event, and then calling RefreshRange on the cell to make sure it gets redrawn with the new properties.

IP Ivan Pelly November 18, 2002 07:05 PM UTC

We're currently attempting to change the celltype with the following code: GridDataBoundGrid1(0, 10).CellType = "Static" Should this work? (It doesn't seem to) Thanks, Ivan Pelly

AD Administrator Syncfusion Team November 18, 2002 10:25 PM UTC

For a GridDataBoundGrid, to change individual cell properties, you will have better results using the PrepareViewStyleInfo event, and setting the e.Style with eth properties you want bases on the e.RowIndex and e.ColIndex values passed in.

Live Chat Icon For mobile
Up arrow icon