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

Virtual Grid - auto-size columns

Thread ID:

Created:

Updated:

Platform:

Replies:

77962 Nov 21,2008 08:41 PM UTC Jun 5,2009 08:43 AM UTC WinForms 6
loading
Tags: GridControl
Joel Reisner
Asked On November 21, 2008 08:41 PM UTC

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 06:25 AM UTC

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 08:41 PM UTC

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

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

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 12:53 PM UTC

Does this work for GridGroupingControl as well?

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

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 08:43 AM UTC

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.

Please sign in to access our forum

or the page will be automatically redirected to 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

;