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

Resizing datagrid rowheader column

I''d like to resize the rowheader column of a GridDataBoundGrid control but find that using grid.Model.ColWidths[0] = 20 resizes all columns (including the rowheader) to the same width. How can I resize just the rowheader column? TIA

3 Replies

AD Administrator Syncfusion Team August 11, 2005 08:27 AM UTC

I think your code is the way to do this. But if you want to do this when the grid is not visible (like in Form.Load), then you also have to set: this.gridDataBoundGrid1.AllowResizeToFit = false; But turning AllowResizeToFit to false, will prevent the other columns to be sized to fit by default. If you want this to happen, then you would also add a call to ResizeToFit. this.gridDataBoundGrid1.Model.ColWidths.ResizeToFit(GridRangeInfo.Cols(1, this.gridDataBoundGrid1.Model.ColCount), GridResizeToFitOptions.IncludeHeaders); Here is a little sample showing this working. http://www.syncfusion.com/Support/user/uploads/GDBG_SizeRowHeader_460c5d41.zip

AD Administrator Syncfusion Team August 12, 2005 02:45 AM UTC

Thanks for your prompt reply Clay however your suggestion only seems to work when the GridDataBoundGrid control is placed on the form in the designer. I still get the same strange behaviour when instantiating and placing the control on the page entirely through code. Any other ideas?

AD Administrator Syncfusion Team August 12, 2005 07:16 AM UTC

I think the same sort of code should work at runtime. Here is the sample with the grid being created and displayed in a button handler. http://www.syncfusion.com/Support/user/uploads/GDBG_SizeRowHeader_4591632b.zip Can you modify this sample to show the problem you are having?

Live Chat Icon For mobile
Up arrow icon