I want to be able to store strings in the DB but some are long and i want to format them such that when i copy them out of SQL and past them into notepad they have line breaks to break up the otherwise single line that runs on forever and hard to read.
lets say i am storing a string of all the session variables like this, how do i include line breaks in here?
StringBuilder theBody = new StringBuilder(); theBody.Append("Session Values: " + " "); foreach (string s in Session.Keys) theBody.Append(s + ":" + Session[s] + " ");
I want to copy the text from a label into a textbox. What happens is the user uploads a file which then generates an ftp link as label2 from the code behind. i want to copy the label2 text into my CDR_Data_LinkTextBox so it is recorded in my database.
I insert a text box, change the parameters to multi line and then pass the string to sql. Users insert comments etc, using line breaks, however because I just pass this as a string the line breaks are not there when they view the text box after input. Example: Here is a well formatted comment. as I typed in the text box today. Inserted in to sql as a string, returns this on select:
Here is a well formatted comment.as I typed in the text boxtoday. How do I insert the line breaks in the string from a textbox?
The problem is while entering the information in this text box, if anyone used enter line or different line or any kind of formatting, as a result i don't get the formatted page or with lines. I see only a paragraph which is very difficult to read and understand.
How to make my textbox compatible with all kind of formatting options so that even if someone paste information from word etc in the text box , i should get the formatter information just like the user pasted the information in the text box...
I have a multiline textbox whose .Text property get saved in an SQL 2008 DB. When I submit the textbox, I loose the returns. How do I handle this?
I've used Enviroment.Newline() to do some html conversion stuff, but I've never ran into this specific problem.
Edit: Nevermind, it was working just fine, but I was replacing " " incorrectly. Stupid mistake. I have to convert the " " to <p> tags. I've done this before, but if anybody wants to answer, I'll mark their answer as correct.
On aspx page I have asp:textbox multilined, where I type data. When I assign TextBox1.text to a string i get something like this:
"line1 line2 line3"
But if I try to set it back to literal, I get:
line1 line2 line3
(without the line barkes)
How to solve it? Is the only way to replace the with <br />?
A note: If I store the in put in database (sqlserver), and open the table in sql management studio -> edit rows-> I see string line1line2line3 (all together), but if try to copy to clipboard this content (Ctrl+C) only line1 is copied! Why? Also, If i bind this data to a repeater, and Eval("myfield") to repeater I get the line brake!
Is there any way to allow page breaks to be used in a multi-line textbox control. I would like the text below to be inserted into my database, so when displayed in a label its not all in one paragraph. Ex:
some text to be inserted in <br/> some more text to be inserted in <br/>
@ artlung, I placed the below code just outside of my form but inside the body. The last line of code I placed inside Panel1 of my form. Anything wrong with this code because nothing happens when I click the Copy to Clipboard button.
The next line of code is above the script tags but inside Panel1 in my form
The problem is that, depending on the width of the screen, the labels (e.g. "Postcode") do not always appear on the same line as the text box/dropdown they refer to. Is there a way of ensuring that, when it needs to "flow" an element down to the next line, it flows the label and the input control together?
I have an asp page with a textboxes, labels and other controls. I cannot get the .text to change in any of these controls. I click on button which I execute code that I expect to update the text but it doesn't work. Something like Textbox1.text = "Hello" Are there page level properties/settings I should look at? I am perplexed an looking for a place to start. I will provide more information as needed. I just don't know where to start.
I am new in asp.net and c#. I am good at php and understands the logic. But i have no idea what is error in this.when I just include one line ' using System;' it shows error. I also tried c# page putting codebeign and calll it but still same error.Here is my test html page and action c# page