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

adjust the height and width of a cell in datagrid

Thread ID:





17442 Aug 9,2004 02:39 PM UTC Aug 10,2004 11:35 AM UTC WinForms 6
Tags: GridControl
Asked On August 9, 2004 02:39 PM UTC

hi I have a textbox with multiline = true and wrap = true with maxSize = 2000 Now this data is being saved into a cell of a datagrid I need to adjust the height and width of the cell(of datagrid) accordingly Can Some One Help me thanks Shri

Administrator [Syncfusion]
Replied On August 9, 2004 03:24 PM UTC

To programatically size the row heights and colwidth, you call grid.Model.RowHeights.ResizeToFit and grid.Model.ColWidths.ResizeToFit. (If you are trying to do this from a point when the grid is not visibl, say in FormLoad, you should also set grid.AllowResizeToFit = false.)

Replied On August 9, 2004 04:37 PM UTC

hi, Thanks! can i set minimum column size(width) so that when it auto resizes the column it doesnt go down certain value Shri

Administrator [Syncfusion]
Replied On August 9, 2004 05:31 PM UTC

There is a GridResizeToFitOption.NoShrink flag you can pass when you call grid.Model.ColWidths.ResizeToFit to prevent the size from decreasing, but I do not think this is what you asked about when you mentioned mimum size. To impose a Minimum size, you would have to first call grid.Model.ResizeToFit and then have code like: Me.Grid.Model.ColWidths[3] = Math.Max(Me.Grid.Model.ColWidths[3], someMinValue) If it flickers too much, you can add a grid.BeginUpdate before you do teh resizing, and a grid.EndUpdate followed by grid.Refresh after the sizing code.

Replied On August 9, 2004 07:08 PM UTC

hi, its working fine except the wrap property ie., if the user has not used the "Enter" key during input into the textbox.... and if the input is one long line then it should wrap itself at the max length of the cell and appear in the next line i tried other ways too but this is not working any suggestions thanks Shri

Administrator [Syncfusion]
Replied On August 9, 2004 08:58 PM UTC

If you drag the row height larger, you should be able to see the multiple lines if you have style.WrapText = true. If you want to have the cell height autosize as you type into the cell, then try setting the style.AutoSize = true for that column.

Administrator [Syncfusion]
Replied On August 10, 2004 11:35 AM UTC

thanks Shri


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