I have a text form that takes in a users input and it is supposed to be
stored in a database and can be viewed from a webpage. I want to be
able to display the text with html special characters like "<", ">" (if
the user typed them in) without it being confused for html code and...
I want to be able to replace a newline character with a "/r/n" whenever
it is used in the text.Hi ebade2000,
String.Replace and Server.HtmlEncode should do the trick.
string s = "<display \r\n me>";
s = Server.HtmlEncode(s); // converts < etc
s = s.Replace("\r\n", "<br>"); // replaces string breaks withhtml
breaks
Response.Write(s);
On Tue, 12 Sep 2006 02:08:12 +0200, <ebade2000@.gmail.comwrote:
Quote:
Originally Posted by
I have this project I am working and I have two tasks
>
I have a text form that takes in a users input and it is supposed to be
stored in a database and can be viewed from a webpage. I want to be
able to display the text with html special characters like "<", ">" (if
the user typed them in) without it being confused for html code and...
>
I want to be able to replace a newline character with a "/r/n" whenever
it is used in the text.
>
--
Happy Coding!
Morten Wennevik [C# MVP]
Thanks that helps a whole lot.
Bade
Morten Wennevik wrote:
Quote:
Originally Posted by
Hi ebade2000,
>
String.Replace and Server.HtmlEncode should do the trick.
>
string s = "<display \r\n me>";
s = Server.HtmlEncode(s); // converts < etc
s = s.Replace("\r\n", "<br>"); // replaces string breaks with html
breaks
Response.Write(s);
>
>
>
On Tue, 12 Sep 2006 02:08:12 +0200, <ebade2000@.gmail.comwrote:
>
Quote:
Originally Posted by
I have this project I am working and I have two tasks
I have a text form that takes in a users input and it is supposed to be
stored in a database and can be viewed from a webpage. I want to be
able to display the text with html special characters like "<", ">" (if
the user typed them in) without it being confused for html code and...
I want to be able to replace a newline character with a "/r/n" whenever
it is used in the text.
>
>
>
--
Happy Coding!
Morten Wennevik [C# MVP]
0 comments:
Post a Comment