Looking for max text length function for a cell

I have used several grids and one feature I found very appealing was the ability to set a max text display length for a cell. If that length was exceeded the grid would automatically truncate the display, add a '...' to the string, and set the tooltip for that cell to display the entire string. For example if the max display length for a cell was 4, the string "Syncfusion rules" would be "Sync..." and when you hovered on that cell the tooltip would display "Syncfusion rules" Does such a feature exist for this grid? Thank you in advance. Tim

1 Reply

AD Administrator Syncfusion Team October 14, 2003 04:41 PM UTC

You can use the GridStyleInfo.Trimming property to specify whether you want to see ellipses if the string will not fit in the cell. Maybe something like this for the whole grid (or you could do it on a cell or column r row basis). this.gridDataBoundGrid1.TableStyle.Trimming = System.Drawing.StringTrimming.EllipsisCharacter; There are a couple of ways to get the tip to show as well. One straight forward way is to use the PrepareViewStyleInfo event.
private void gridDataBoundGrid1_PrepareViewStyleInfo(object sender, Syncfusion.Windows.Forms.Grid.GridPrepareViewStyleInfoEventArgs e)
{
	e.Style.CellTipText = e.Style.Text;
}
You may want to conditionally do this based on teh length of the text.

Loader.
Up arrow icon