This is primarily concerned with visual basic, althought it might have applications in other languages.
Visual Studio supplies a formview control for web-based applications that can be bound to a SQL Server database. In edit mode, a control can be made to be multiline, and thus accept carriage returns and line feeds. When the item is saved, the carriage return/line feed is converted to a Microsoft.VisualBasic.vbCr
Lf character. This charcter is not displayed when viewing the record in view-only mode, so if I enter:
------------
Jack Be Nimble
Jack Be Quick
Jack Jumped because he was a goon
Thank you.
--------------
Is displayed as:
Jack Be NimbleJack Be QuickJack Jumped because he was a goon
--------------
I have found that the vbcrlf is stored in the SQL database (some have suggested it is not), but to convert it to a display-only, I need to do a replace function, replacing the vbcrlf with a <BR /> to make it "web compatible". But then, if I need to edit that same record, I need to remove the "<BR />'s and replace them back with vbcrlf's.
It's important that the CRLF's remain consistent between the database, the editing / entering display, and the read only display in, for example, the formview control (I'm sure other web-based controls have the same issue). Is there any other solution than doing this "replace" function every time the user changes views? I'm hoping there's a simple property there that I haven't yet discovered.
CRLF's should be carried from database to webview without need of coding, or with a minor property change. Any help.
Start Free Trial