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. (Last updated on: November 16, 2018).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

Changing the length of cell holding column names in DBDG

Thread ID:





47697 Aug 10,2006 09:16 AM UTC Aug 10,2006 09:33 AM UTC WinForms 1
Tags: GridControl
Asked On August 10, 2006 09:16 AM UTC

Hi all,

I''m using DBDG.
when I load a table, the column names get spanned on two lines as the space is not sufficient to show the column name in one line.
Can some one tell how to dynamically change the width of column to match with the length of the text held by that cell.

Thanks in advance

Administrator [Syncfusion]
Replied On August 10, 2006 09:33 AM UTC

Hi Suhas,

Please set the AllowResizeToFit property of the databoundgrid to true in the form_Load, this will help you to display the entire name in single line. This property is true by default.

this.gridDataBoundGrid1.AllowResizeToFit = true;

You can call the ResizeToFit method to dynamically make the contents of the cell to fit inside.
this.gridDataBoundGrid1.Model.ColWidths.ResizeToFit( GridRangeInfo.Col(2) ); // resizes column 2

FYI, you can also set the column widths manually for any particular column,like in the code below,
this.gridDataBoundGrid1.Model.ColWidths[2] = 75; // setting the column width for column2



This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

Please sign in to access our forum

This page will automatically be redirected to the sign-in page in 10 seconds.

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon