1

I have a C# program that uses an Infragistics UltraWinGrid to display comments. A comment can be multiple lines. That is, it can contain carriage return/line feeds (CRLFs). (See the upper portion of the attached screenshot.) But when the user selects the text of the comment by clicking on the cell, it loses the CRLFs. (See lower portion.) This is a problem, because comments can be very long and the user may want to copy and paste a comment somewhere else without losing the formatting.

From what I understand, this problem results because the grid uses a Windows textbox as an editor when the user clicks on a cell. Is there some way that I can either make the textbox keep the CLRFs or replace the textbox with an editor that does? Thanks.

enter image description here

Tim
  • 185
  • 1
  • 3
  • 15

4 Answers4

1

Turns out there are a few stars that need to align for this.

Of course CellMultiLine needs to be set for the column like wnvko pointed out.

But also, you must make sure your Column Style is NOT FormattedText or FormattedTextEdit. (If that's required for editing i think you are out of luck). Just use Default style.

And finally make sure you CRLFs are actually truly CRLFs. My best suggestion is to use Environment.NewLine. If you are pulling the data from the DB, make sure you use CHAR(13) + CHAR(10) in that specific order. See Differences Between vbLf, vbCrLf & vbCr Constants

Hope this helps 4 years later. :-) But wanted to share for others since i found no solution elsewhere.

KAW
  • 73
  • 1
  • 6
  • A little late to help with the original problem, but some nice points to keep in mind for the future. Thanks. – Tim Aug 25 '21 at 20:38
0

My suggestion is to use Templates. Have a look at the official Infragistics UltraWebGrid help book that is explaining in depth how to configure features like Row and Column Templates.

Go to page 74 for more information regarding the templating.

Zdravko Kolev
  • 1,569
  • 14
  • 20
  • I looked at the section on Row and Column Templates, but t am unable to find a "Templated" checkbox. Is it possible that templates have been replaced by something else in later versions? I am using 14.1. – Tim Feb 16 '17 at 17:22
  • As I see from the IG forum there is a checkbox type template column: Source: http://www.infragistics.com/community/forums/t/64964.aspx – Zdravko Kolev Feb 17 '17 at 15:03
  • Zdravko Kolev, I just realized that the link you sent me was for an UltraWebGrid. I assume that control can only be used on a web page. I'm using UltraWinGrid. – Tim Feb 17 '17 at 18:11
  • Hey Tim, yep UltraWebGrid is ASP.NET control – Zdravko Kolev Feb 20 '17 at 08:48
0

You should set CellMultiLine of the column to True. Here is how it is working when I set it in my grid enter image description here

wnvko
  • 1,985
  • 1
  • 14
  • 18
0

I never found a real answer to this question, but I was able to do a workaround by capturing the click event and having it open a small dialog box containing the cell text. I had the dialog box open at the point the user clicked, so that it appeared over the cell. After a few minor adjustments to take care of border conditions, it worked surprisingly well, so I'm calling this one solved. Thanks, everyone, for your suggestions.

Tim
  • 185
  • 1
  • 3
  • 15