Click here to Skip to main content
15,881,856 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi all,

I have two textboxs with textmode=multiplelines now insert into database and retrieve the data.
my textbox text like is

1.check text to ensure it is well written and logically structured
2.correct grammar and spelling
3.ensure the text is in line with the publisher's 'house style'
4.check facts and raise queries with the author
5.look out for potential legal problems and discuss them with the publisher
6.check illustrations and captions are correct.

insert into database, but whenever retrieve the data from database format is missing and its show as big paragraph. my data show like..

1.check text to ensure it is well written and logically structured 2.correct grammar and spelling 3.ensure the text is in line with the publisher's 'house style' 4.check facts and raise queries with the author 5.look out for potential legal problems and discuss them with the publisher 6.check illustrations and captions are correct.

how to display the same format after retrieving data from database.

please give any ideas.


thanking you
Posted

string DBData=""; // variable with data stored in database.
string HtmlData = DBData.Replace(Environment.NewLine, "<br />");
 
Share this answer
 
v2
Comments
Santhosh23 10-Jan-13 7:03am    
hi thanks for your replay, i have doubt for above code. the two lines are used for which time insert into database or retrieve the data from database.
willempipi 10-Jan-13 7:07am    
Sorry for my sort answer, I thought you'd connect the dots ;)

The problem is that there is no HTML styling in the data that you get from you multiline textbox, it uses a /r/n code as a pagebreak, which is not shown on a website. Therefore you can replace all pagebreaks with HTML-pagebreak by using the Replace(Envirement.NewLine, "<br />") code.
Santhosh23 10-Jan-13 7:14am    
hi, what is Envirement.? please provide full code. i cant understand your short code
willempipi 10-Jan-13 7:20am    
Sorry typo: Environment.NewLine
[no name] 10-Jan-13 7:24am    
@willempipi : I have modified typo ...oops.
XML
string descri = "input text or retrieve text from database";
                span.InnerHtml = descri.Replace(System.Environment.NewLine, "<br/>");


its working fine,

thanks and regards
 
Share this answer
 
Comments
fjdiewornncalwe 10-Apr-13 13:00pm    
Again, your solution is the same as Solution 1. Why not give credit to that person by marking their answer as the solution and upvoting it. Just posting your own answer is not the right way to do this.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900