Click here to Skip to main content
15,907,910 members
Please Sign up or sign in to vote.
1.00/5 (2 votes)
See more:
Hi,
I am trying use string that contain HTML tag.

For example:
C#
string str= "<p> </p>
<p style="MARGIN-BOTTOM: 0px; MARGIN-TOP: 0px"><font size="2" face="Arial">Dear  Traders,</font></p>
<p style="MARGIN-BOTTOM: 0px; MARGIN-TOP: 0px"><font size="2" face="Arial">"


If only have " inside our main " ", we can solve that by /# /# very easy.
But When have " ;" how can fix this error.
Compiler when read ; suppose thats end of line and string and gives error.
How can write this to avoid this error?

Regards,
Posted
Comments
[no name] 28-Aug-13 14:56pm    
The problem is not the semicolon. The problem is that you need to escape the double quote characters inside your string.
Rezame 28-Aug-13 14:58pm    
escaped that, but error again.
[no name] 28-Aug-13 15:02pm    
What does "error again" mean? Did you escape ALL of the double quote characters or just one?

1 solution

C#
String str= @"<p> </p>
<p style=""MARGIN-BOTTOM: 0px; MARGIN-TOP: 0px""><font size=""2"" face=""Arial"">Dear  Traders,</font></p>
<p style=""MARGIN-BOTTOM: 0px; MARGIN-TOP: 0px""><font size=""2"" face=""Arial"">";
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900