donnacha Posted November 3, 2003 Posted November 3, 2003 Hi folks, has anybody managed to solve the long standing problem of having multi line text in a cell of a datagrid. I know this has been around the forum for a while, but somebody may have cracked it. Looking forward to see if there are any new ideas. Quote Hamlet
Moderators Robby Posted November 3, 2003 Moderators Posted November 3, 2003 Which problem? Quote Visit...Bassic Software
donnacha Posted November 3, 2003 Author Posted November 3, 2003 I takeit you haven't tried displaying text in a datagrid that needs more than one line to display it. I know one can autosize a colume to fit the text, but my column must remain the same size. Thus try displaying a large amount of text in 1 of the rows and have that individual row resize and each other row resize to the number of lines necessary. The word-wrap and multiline fields in the datagridtextboxcolumn do not seem to do the as the imply. Thus there-in lies the problem Quote Hamlet
Moderators Robby Posted November 3, 2003 Moderators Posted November 3, 2003 Sure I have, my solution to this was to display only the first n characters in that column. If this suits you let me know. Quote Visit...Bassic Software
donnacha Posted November 4, 2003 Author Posted November 4, 2003 Hi Robby, I wish life was so simple, I have to display all the text in the grid and it can be any length from 1 to 1024 or larger. I know it can be done as there are commercial version of it available, but I am not in a position to use them as I need to have all the source code in my application. So any ideas would be great. I am currently getting around the problem by drawing my own datagrid with labels/testboxes/richtextboxes but this is very slow to draw (and vissible) if there is a lot of data. Quote Hamlet
Moderators Robby Posted November 4, 2003 Moderators Posted November 4, 2003 Here's an untested approach, replace the default label in the ItemTemplate with a multiline textBox, the width property of a textBox is more managable then that of a label. Quote Visit...Bassic Software
donnacha Posted November 5, 2003 Author Posted November 5, 2003 Hi Robby, I have never used ItemTemplate, but the help seems to indicate that they are only accessible for mobile wev forms. I am in a standard windows app. Thanks Quote Hamlet
Moderators Robby Posted November 5, 2003 Moderators Posted November 5, 2003 Not true, TemplateColumn can contain an ItemTemplate which can contain any control. Here's a simple howTo http://authors.aspalliance.com/aspxtreme/webforms/controls/addingtemplatecolumnstodatagrid.aspx Quote Visit...Bassic Software
donnacha Posted November 5, 2003 Author Posted November 5, 2003 Hi Robby, thanks for that, but again this is for web/asp. It isin't available for windows controls. And as far as I know the same word wrap problem does not exist for web style grids. Thanks Quote Hamlet
Moderators Robby Posted November 5, 2003 Moderators Posted November 5, 2003 You're kidding, this entire time I thought you were using Web forms. Sorry. Quote Visit...Bassic Software
IanMac Posted November 6, 2003 Posted November 6, 2003 So does anyone have any idea about how to do it in windows controls?? Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.