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.
Unfortunately, activation email could not send to your email. Please try again.

Virtual Grid - auto-size columns

Thread ID:

Created:

Updated:

Platform:

Replies:

77962 Nov 21,2008 03:41 PM Jun 5,2009 04:43 AM Windows Forms 6
loading
Tags: GridControl
Joel Reisner
Asked On November 21, 2008 03:41 PM

We have a virtual grid that is used for scrolling over a large set of data. How can we make the columns auto-size themselves based on their caption?


Rajadurai C [Syncfusion]
Replied On November 24, 2008 01:25 AM

Hi Joelr,

Thanks for your interest in Syncfusion products.

For a virtual grid, you can achieve the column width based on the text length in cells through the ResizeToFit property.


void gridControl1_PrepareViewStyleInfo(object sender, GridPrepareViewStyleInfoEventArgs e)
{
if (e.Style.CellType == "TextBox")
this.gridControl1.ColWidths.ResizeToFit(GridRangeInfo.Col(e.ColIndex), GridResizeToFitOptions.NoShrinkSize);
}


Regards,
Rajadurai


Steven Mohnkern
Replied On June 3, 2009 04:41 PM

Is there a similar way to auto size the height of rows?

Jisha Joy [Syncfusion]
Replied On June 4, 2009 05:29 AM

Hi Steve,

Please see the following code for code for auto size the height of rows.

this.gridListControl1.Grid.RowHeights.ResizeToFit(GridRangeInfo.Cells(1, 1, row, col));

Please let me know if this helps.

Regards,
Jisha

Steven Mohnkern
Replied On June 4, 2009 08:53 AM

Does this work for GridGroupingControl as well?

Jisha Joy [Syncfusion]
Replied On June 5, 2009 04:40 AM

Hi,

For gridgrouping control you could access the property using the TableModel. Please see the code:

this.gridGroupingControl1.TableModel.RowHeights.ResizeToFit(GridRangeInfo.Table());

Please let me know if this helps.

Regards,
Jisha

Jisha Joy [Syncfusion]
Replied On June 5, 2009 04:43 AM

Hi,

For gridgrouping control you could access the property using the TableModel. Please see the code:

this.gridGroupingControl1.TableModel.RowHeights.ResizeToFit(GridRangeInfo.Table());

Please let me know if this helps.

Regards,
Jisha

CONFIRMATION

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.

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.

;