Click here to Skip to main content
Rate this: bad
good
Please Sign up or sign in to vote.
See more: C#ASP.NET
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 10-Jan-13 0:54am
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 1

 string DBData=""; // variable with data stored in database.
 string HtmlData = DBData.Replace(Environment.NewLine, "<br />");
  Permalink  
v2
Comments
Santhosh23 at 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 at 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 at 10-Jan-13 7:14am
   
hi, what is Envirement.? please provide full code. i cant understand your short code
willempipi at 10-Jan-13 7:20am
   
Sorry typo: Environment.NewLine
Turbo_23 at 10-Jan-13 7:24am
   
@willempipi : I have modified typo ...oops.
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 3

string descri = "input text or retrieve text from database";
                span.InnerHtml = descri.Replace(System.Environment.NewLine, "<br/>");
 
its working fine,
 
thanks and regards
  Permalink  
Comments
Marcus Kramer at 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)

  Print Answers RSS
Your Filters
Interested
Ignored
     
0 Sergey Alexandrovich Kryukov 472
1 sanket saxena 355
2 CPallini 205
3 thatraja 200
4 OriginalGriff 195
0 Sergey Alexandrovich Kryukov 8,784
1 OriginalGriff 5,025
2 Peter Leow 3,839
3 Maciej Los 3,535
4 Er. Puneet Goel 3,107


Advertise | Privacy | Mobile
Web04 | 2.8.140415.2 | Last Updated 10 Jan 2013
Copyright © CodeProject, 1999-2014
All Rights Reserved. Terms of Use
Layout: fixed | fluid