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

Programatically changing the height of the grid control?

I need to be able to have my grid control be sized so it precisely fits X amount of rows. My trouble is, how do I know how height my control should be? I first tried something like this: for (int i=1;i
2 Replies

AD Administrator Syncfusion Team February 11, 2004 02:41 PM

A couple of comments. You need to start your loop from 0 and not 1. Row 0 is the Columns headers, so you need to account for that as well unless they are hidden. (The header row is little taller by default than the othe rrows). You can use the method grid.Model.RowHeights.GetTotal to sum up row heights. You can set the backcolor of the grid''s client area that is not occupied by cells (the gray part you mentioned) by setting grid.Properties.BackgroundColor.


MH Mark Hoffman February 11, 2004 05:01 PM

Perfect! Thanks! >A couple of comments. You need to start your loop from 0 and not 1. Row 0 is the Columns headers, so you need to account for that as well unless they are hidden. (The header row is little taller by default than the othe rrows). > >You can use the method grid.Model.RowHeights.GetTotal to sum up row heights. > >You can set the backcolor of the grid''s client area that is not occupied by cells (the gray part you mentioned) by setting grid.Properties.BackgroundColor. >

Loader.
Live Chat Icon For mobile
Up arrow icon