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

DataTable column with very long text

I am using a DataBoundGrid and I have a column which contains some very long text. If I let the Grid do its own thing it just displays this the cells as one very long row of text. The first problem is that the width of the column is much wider than the width of my form (or indeed of my screen). With the Grid behaviour as it is it is impossible to scroll part way along the column - the Grid just jumps to the next column. If I try editing the cell and moving the caret left it just disappears off the screen. So that is my first question: how can I allow the whole of this column to be made visible by scrolling? The second is: what is the best way of limiting the width of the column and making it increase in height instead. Hope you can help. Sam

1 Reply

AD Administrator Syncfusion Team March 30, 2004 10:26 AM UTC

1) This is really not supported. The cell has to be fully visible in order to edit it. The reason is that you cannot clip a EditControl except at its parent window borders. If you have a edit control in the middle of a grid, then you cannot clip it at the edge of its grid cell. You can do some things to be able to scroll the text to see it. Here is a sample that uses covered cells to allow this. forum12423_1005.zip You can also try deriving a cell control that holds a TextBox with a horizontal scrollbar. This solution may also allow you to edit it in a custom TextBox that allows horizontal scrolling using a scrollbar. (Haven''t tried this, so I do not know what problems you may encounter.) 2) Go ahead and set the colwidth for the column to be the desired width you want it to be (preferably something less than the clientwidth of the grid so you can edit it). Also, make sure the style for the column has WrapText = true set. The if you call grid.Model.RowHeights.ResizeToFit passing it the column range, it should resize the row heights to make everything visible.

Live Chat Icon For mobile
Up arrow icon