Answered by:
carriage returns in Access

Question
-
User-911157248 posted
The problem I am having is when a user types in a paragraph in a multiline textbox and I insert it into an access memo field, it all gets saved in one solid paragraph with missing line feeds / carriage returns. How to solve this?
Friday, October 15, 2010 11:25 AM
Answers
-
User-911157248 posted
I have figured it out, does this make sense? I moved the replace line to the top of my code rather then where it was (3rd line from the bottom.)
tb3 = tb3.Replace(Environment.NewLine, "<BR>")
AccessDataSource1.InsertParameters.Clear()
AccessDataSource1.InsertParameters.Add("tb3", TypeCode.String)
AccessDataSource1.InsertParameters("tb3").DefaultValue = tb3
AccessDataSource1.InsertCommand = "insert into blah values (@tb3)"
AccessDataSource1.Insert()
- Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
Monday, October 18, 2010 11:22 AM
All replies
-
User-1199946673 posted
How do you conclude this? Because when you show the content of the memo field in HTML, a line feed / carriage return will not be displayed in HTML, you must replace them with <br> tags
Friday, October 15, 2010 11:54 AM -
User-911157248 posted
I have the memo field set to rich text to experiment. I display the memo using aa detailsview. But anyhow what are my options?
Friday, October 15, 2010 12:43 PM -
User-1199946673 posted
In the ItemTemplate, use
<asp:Label ID="Label1" runat="server" Text='<%# Eval("memofield").ToString().Replace(Environment.NewLine, "<br />") %>' />
Friday, October 15, 2010 6:29 PM -
User-911157248 posted
Does this address the multi line textbox I have? Are you using a label instead?
Monday, October 18, 2010 8:56 AM -
User-1199946673 posted
Does this address the multi line textbox I have? Are you using a label instead?Yes, you can use this in teh ItemPTemplate of the detailsview... It would help if you showed the html markup of your detailsview?
Monday, October 18, 2010 10:24 AM -
User-911157248 posted
I have figured it out, does this make sense? I moved the replace line to the top of my code rather then where it was (3rd line from the bottom.)
tb3 = tb3.Replace(Environment.NewLine, "<BR>")
AccessDataSource1.InsertParameters.Clear()
AccessDataSource1.InsertParameters.Add("tb3", TypeCode.String)
AccessDataSource1.InsertParameters("tb3").DefaultValue = tb3
AccessDataSource1.InsertCommand = "insert into blah values (@tb3)"
AccessDataSource1.Insert()
- Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
Monday, October 18, 2010 11:22 AM -
User-1199946673 posted
This is one of many ways. If it works for you then it is OK....
Monday, October 18, 2010 3:20 PM