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

Formatting Grid Headers the same as databound grid

Hi, My project uses both databoundgrids and normal grids. In the later, I use the .Rows.HeaderCount property to format the first couple of rows. These turn out shaded in a ''gradient'' that looks really good. My users want the other databound grid to look the same, but unfortunately I''m having trouble figuring out how to do it. I''ve tried .model.rows.headercount but this gives a different result. Can you please assist? Cheers DS

4 Replies

AD Administrator Syncfusion Team May 6, 2004 05:10 AM UTC

In a GridDataBoundGrid, the ''default'' style for a column header is found in grid.BaseStyleMap["Column Header"].StyleInfo. So, you can set styles for all headers by changing that object. If you want to do something on a header cell by header cell basis, then you can handle the PrepareViewStyleInfo event and set the styles there ''on demand''. Here is a little sample.


AD Administrator Syncfusion Team May 6, 2004 05:10 AM UTC

Forgot the sample. HeadersInGDBG_8898.zip


DS Damien Sawyer May 9, 2004 08:52 PM UTC

Thanks Clay, that''s great. One thing however, the vertical lines between the header cells have dissappeared. Can they be brought back easily? Cheers DS


AD Administrator Syncfusion Team May 10, 2004 04:45 AM UTC

Normally, the header borders are drawn becauce the default header cells are drawn with a Raised effect. So, you can get the same effect by setting style.CellAppearance = GridCellAppearance.Raised;

Loader.
Live Chat Icon For mobile
Up arrow icon