| | |
Saving text in asp.net
Please support our ASP.NET advertiser: PostgreSQL or MySQL? Compare and contrast the two most popular open source databases
Thread Solved |
•
•
Join Date: Oct 2007
Posts: 7
Reputation:
Solved Threads: 0
Hey folks,
I have this problem, lets take this text from from 24ways.org just for example->
And Im making a site, which uses MSSQL and like above text if I save it to database (varchar(MAX)) it does loose all formattings and its just direct text without any Enters or formats. So how I dont loose formattings. Thnx.
I save the text this way and the MAIN text is that BlogBox.Text
I have this problem, lets take this text from from 24ways.org just for example->
•
•
•
•
Elbow room
Paying attention to your typography is important, but it’s not just about making it look nice.
Careful use of the line-height property can make your text more readable, which helps everyone, but is particularly helpful for those with dyslexia, who use screen magnification or simply find it uncomfortable to read lots of text online.
When lines of text are too close together, it can cause the eye to skip down lines when reading, making it difficult to keep track of what you’re reading across.
So, a bit of room is good.
I save the text this way and the MAIN text is that BlogBox.Text
ASP.NET Syntax (Toggle Plain Text)
string ins = string.Format("INSERT INTO blogs (topic, date, blog, author) VALUES ('{0}', '{1}', '{2}', '{3}')", TopicBox.Text, DateTime.Now.ToString("g"), BlogBox.Text, User.Identity.Name.ToString()); SqlDataSource1.InsertCommand = ins; SqlDataSource1.Insert();
•
•
Join Date: Oct 2007
Posts: 7
Reputation:
Solved Threads: 0
Hmm, I've tryed something... I came now with this idea but i dont know how to do it.
How can I read Textbox.Text and parse it is there \r in between lines and so then I could add to the string \r (and of course multiline=true) ? or can it?
Or is there something easier, simple property that i could set to True from properties
How can I read Textbox.Text and parse it is there \r in between lines and so then I could add to the string \r (and of course multiline=true) ? or can it?
Or is there something easier, simple property that i could set to True from properties
You can use regular expressions but that is complex for this. To use simple formating, just replace control characters with html, like:
Then just use htmlText in your insert command.
•
•
•
•
Dim htmlText As String = BlogBox.Text
htmlText = htmlText.Replace(ControlChars.CrLf, "<br />")
•
•
Join Date: Jan 2008
Posts: 2,052
Reputation:
Solved Threads: 123
there are free asp.net html editors, you can include them in your project so when text is copied and paste to html editor, it will keep all the formatting tags.However, to enter html, i guess you will have to set validaterequest attribute of the page to false in order not for asp.net to generate request validation error.
Due to lack of freedom of speech, i no longer post on this website.
•
•
Join Date: Jan 2008
Posts: 2,052
Reputation:
Solved Threads: 123
can you give us a complete example?
Due to lack of freedom of speech, i no longer post on this website.
•
•
Join Date: Sep 2007
Posts: 1,080
Reputation:
Solved Threads: 68
ASP.NET Syntax (Toggle Plain Text)
TextBox1.Text.Replace(Environment.NewLine, "<br/>")
![]() |
Similar Threads
- fares (ASP.NET)
- Saving information from .NET Listbox into SQL Server 2000 (ASP.NET)
- URGENT!: Saving Database information from ASP.NET Button (ASP.NET)
- download and upload (ASP.NET)
Other Threads in the ASP.NET Forum
- Previous Thread: Removing Query Strings
- Next Thread: good way of validating login info vs SQL D/B
Views: 1081 | Replies: 6
| Thread Tools | Search this Thread |
Tag cloud for ASP.NET
.net 2.0 activexcontrol advice ajax alltypeofvideos anathor application asp asp.net bc30451 bottomasp.net browser button c# checkbox click commonfunctions confirmationcodegeneration connection css dataaccesslayer database datagridview datagridviewcheckbox datalist deadlock development dgv dropdownlist edit editing expose feedback flash form formatdecimal forms formview google grid gridview hosting iframe iis javascript jquery list listbox login microsoft migration mono mouse mssql multistepregistration news numerical object objects panelmasterpagebuttoncontrols parent problem project radio reportemail richtextbox rotatepage save schoolproject search security services session silverlight smartcard software sql sql-server sqlserver2005 suse textbox theft tracking unauthorized update validation vb.net video videos view virtualdirectory vista visualstudio web webapplications webdevelopemnt webprogramming webservice youareanotmemberofthedebuggerusers






