Reputation: 1027
When i inserting the data in database then there is facility to the user that in multiline textbox he can write sentence in multiple line. So when i am populating the same data the database it populate the data like this : fffffffffffffffffffffffffffffff<br /> f<br /> f<br /> f<br /> f<br /> f<br /> f<br /> f<br /> f<br /> <br /> ff<br /> f<br /> f<br /> <br /> <br /> <br /> fff
but i want to remove <, > ,br. For this i have used following code but my purpose is not solved. So how to do that:
txtEditorOpportunity.Text = dbReader["DESCRIPTION"].ToString().Replace("<br/>", "\n");
Upvotes: 0
Views: 6934
Reputation: 3333
You are doing it correctly. Just observe the tags that you are getting, they contain a space between "". So make sure that you put a space in your replace command accordingly. Something like this.
.Replace("<br />", "\n");
Some browsers treat <br />
as just <br>
, so to be sure that nothing goes wrong, you can replace the above code with the following code.
.Replace("<br />", "\n").Replace("<br>", "\n");
Upvotes: 1
Reputation: 1177
There is a space in the <br />
tag in your question, so while using Replace
method. Try it like
.Replace("<br />", "\n");
Note the space character between br and / which makes it <br />
and NOT <br/>
Upvotes: 1