I have an UltraGrid that has one column that may have a lot of data in it to display (but not edit). I set the CellActivation = Activation.ActivateOnly and VertScrollBar = true. This works fine. When the user clicks on a cell with a lot of data the vertical scroll bar appears as expected however the fomatting in the cell is lost. How can I retain the formatting while keeping the vertical scroll bar functionality. I tried to post a before and after screen shot but the site only allowed me to post 1 attachement so here is the after shot.
I am speculating because I don't see anything wrong with the formatting going by the screenshot...When you put a cell into edit mode a TextBox control is displayed therein, and the .NET TextBox does not support GDI+, where cells render this way by default. The result is a different number of characters per line which, if you were relying on the way they look when not in edit mode, would be different when in edit mode. If I misunderstood this please post the before/afer screenshots by zipping them and posting the .zip and we'll try to help.
Hi Brian,
Thanks for your reply and explanation. As you requested I am including before and after screen shots as an attached zip file for your review.
I am wondering if I am stuck with this behavior or is there a viable solution?
Thanks in advance
Omer
Hi Omer,
My guess is that this has to do with the data itself and how it's creating line breaks. It looks to me like when the cell is not in edit mode, the line breaks are being handled correctly, but when it does into edit mode and the cell uses a TextBox to display the data, the TextBox is not recognizing the line break characters.
Your data probably contains a single Carriage Return or a single Line Feed character, but not both, for each line break and the inbox TextBox control does not recognize this as a valid line break.
I assume your data is coming from a DataBase. Try binding the same field to a TextBox control and I expect you will get the same, unformatted, result.
If that's the case, then you need to correct the data itself in order to get it to display properly.
Hi Mike,
Thanks for your response. Yes the data is coming from a database that is stored in a text field. I don't know how the data is being stored to begin with so I guess I will have to look into that. Thanks for all of your help.
Kind regards
Sorry for the late reply but just got a chance to look into the text formatting issue that you raised in your last post.
As you mentioned we are indeed storing the text in a database with "\line" character for a new line instaed of "\r\n". The reason for this is that we want to display this text in a rich text box in another part of the application.
So I guess the question is how can I replace the "\line" character with "\r\n" when a user clicks on a cell?
Thanks