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

Increase rowheight automatically to max in a GridDataBoundGrid

Thread ID:





2467 Jan 22,2003 02:45 PM UTC Mar 11,2014 09:00 PM UTC WinForms 6
Tags: GridControl
Asked On January 22, 2003 02:45 PM UTC

I try to increase the height of a row in a GridDataBoundGrid to max necessary right after loading. There's just one column in the row and the cells can contain several lines. So it would be very nice, if all lines in every cell will be displayed at startup. The TableStyle.AutoSize property increases automatically the height of the row, when text in a cell is edited. But what do I have to do to get this right after the form is loaded? In MS environment, a doubleclick on the boarder of a column or a row header will in- or decrease the column width/row height to the necessary. Could you please also tell me, who I can handle this? Thanks.

Administrator [Syncfusion]
Replied On January 22, 2003 06:54 PM UTC

First, make sure that GridDataBoundGrid.AllowResizeToFit is set to false. If this is true, the grid will try autosize columns widths based on the header cells. This may undo any other sizing you may have done. Then use the ResizeToFit call to size the range you are interested in. So, to autosize all the rowheights in your grid, in form_load, try this.gridDataBoundGrid.Model.RowHeights.ResizeToFit(GridRangeInfo.Table(),GridResizeToFitOptions.NoShrinkSize);

Charles Carlin
Replied On January 24, 2003 05:53 PM UTC

I was doing this successfully with some multi line entries in the grid and all was working fine until I decided to switch to an embedded grid control (which looks and works great by the way). Now I basically have an embedded grid (one column with image and text on multiple rows) in one of my grids columns (on every row). However now the resize code doesn't recognize the embedded grids size. Is there anyway to modify the GridinCell class so it will work with the ResizeToFit method?

Administrator [Syncfusion]
Replied On January 24, 2003 08:44 PM UTC

Hi Chuck, you can override the OnQueryPrefferedClientSize method of the cell model (see GridCellModelBase class reference). This method will be called to determine the correct size of the cell when ResizeToFit is called. Stefan

Bruce Onder
Replied On February 16, 2003 11:54 PM UTC

I'm having a bit of a challenge performing the following: My client application has an order entry grid that users can type a product number into one column, and then I pre-fill the majority of the rest of the columns for that row -- product description, etc. For some products, the default height of the row is enough to display the full product. However, for some products the description is cut off, and I need to change the rowheight to display the full description. I have tried the comments in this thread, but I am not getting any resize to occur. Any thoughts?

Administrator [Syncfusion]
Replied On February 17, 2003 12:04 AM UTC

After you fill the row with data you should call RowHeights.ResizeToFit(GridRangeInfo.Row(rowIndex), GridResizeToFitOptions.NoShrinkSize); The cells should have style.WrapText = true set. Stefan

Scott Wheeler
Replied On March 11, 2014 09:00 PM UTC

Ha! This post was helpful even 11 years later. Thanks!


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

Live Chat Icon For mobile
Live Chat Icon