Answered by:
Passing values to accessdatasource programatically

Question
-
User-57501535 posted
Hi,
I have an AccessDataSource that inserts the text of a multi line textbox. I want to do the following before inserting the value: txtBx.text.Replace(chr(10),"<br />").
I searched the web and this forum but none of the results had the answer,
Thank you for your help.
Saturday, March 21, 2009 3:37 PM
Answers
-
User-821857111 posted
If you want to manipulate a value before inserting it, you can do it in the Inserting event of the DataSource control: http://msdn.microsoft.com/en-us/library/system.web.ui.webcontrols.sqldatasource.inserting.aspx
- Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
Tuesday, March 24, 2009 3:42 AM
All replies
-
User-821857111 posted
I wouldn't do it that way. I would do the Replace() when you show the text. One day, you might want to do something else with the database content, like print it. You wouldn't want embedded html in it then. Here's how to replace linebreaks with <br /> when you display it on a web page: http://www.mikesdotnetting.com/Article.aspx?ArticleID=20
Saturday, March 21, 2009 4:39 PM -
User-57501535 posted
Thank you - I will certainly use that from now on,
But how can I pass this value to a AccessDataSource to be inserted into the database.
Monday, March 23, 2009 11:02 PM -
User-821857111 posted
If you want to manipulate a value before inserting it, you can do it in the Inserting event of the DataSource control: http://msdn.microsoft.com/en-us/library/system.web.ui.webcontrols.sqldatasource.inserting.aspx
- Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
Tuesday, March 24, 2009 3:42 AM -
User-57501535 posted
Thanks for taking the time Mike.
Tuesday, March 24, 2009 11:30 PM