Preserve textbox formatting after postback?
I am building an HTML scrubber, basically an internal tool to clean up a problematic html page. I am creating a tool as a web application using ASP.NET 3.5.
It consists of a button and two multi-line text fields.
I am programming it so you paste the HTML you want to clear at the top of the window. Click the button and the cleaned up HTML appears at the bottom of the screen. (some regex methods do cleanup).
Everything seems to work fine, except that the cleaned HTML is sent to the bottom text block on the same line. All carriage returns and tabs are removed. Basically I paired it down to this simple piece of code that will strip out formatting.
TransformHTML = RawHTML.Text;
BEHtml.Text = TransformHTML;
How can I ensure that the formatting of the first textbox is carried over to the second textbox when I assign it? Thanks.
UPDATE: This seems to be a bit of a confusion about what I am doing. I give the textbox a set of HTML, like this:
<tr>
<td align="left" valign="middle" colspan="6" style="padding-left: 5px;"><strong><a name="Cell_line" id="Cell_line"></a>CELL LINE REFERENCE TABLE</strong> </td>
</tr>
When I click the submit button and the button has source
TransformHTML = RawHTML.Text;
BEHtml.Text = TransformHTML;
basically copies the string Textbox.Text into a string variable and then assigns that string variable to another Textbox.Text. I am getting the following output:
<tr> <td align="left" valign="middle" colspan="6" style="padding-left: 5px;"><strong><a name="Cell_line" id="Cell_line"></a>CELL LINE REFERENCE TABLE</strong> </td> </tr>
I would love that, so when I hit submit it is multi-line but not one.
From the point of view that I am clearing the HTML, it is irrelevant to the example I am providing.
a source to share
Striking out all the HTML won't you strip all the formatting? If you want to keep it, you may need to reduce your aggression a little.
Also, make sure the wordwrap option is set for the second textarea (maybe that simple?)
Answers from the original question: . The answer above made me check my ASP.NET TextBox tag again and it was missing. TextMode = "MultiLine"
a source to share