Link to home
Start Free TrialLog in
Avatar of nirisan
nirisan

asked on

How do i give a string with html and double quotes as a string in VB.net without compiler errors

Hi,

I want to give this as a string and assign it to a variable : '<p style="margin: 0px; font-weight: normal;"> {1}</p>'
i.e
I want to put it between double quotes and assing it to var

dim var as String = ""

Please suggest with code.

thanks
ASKER CERTIFIED SOLUTION
Avatar of MasterPage
MasterPage
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial

Dim str as String
str = "'<p style=""margin: 0px; font-weight: normal;""> {1}</p>'"
FYI, MasterPage I think nirisan needs the opening and ending single quote in the string too.
Avatar of nirisan
nirisan

ASKER

thanks,

I am compiling without errors but it renders as text on the page.
Here is how i gave it with 4 double quotes per double quote. But how do i set it for the browser not to display as html as it is a property for the style. Below are tow variables i am using.

var = "'<p style=""""margin: 0px; font-weight: normal;""""> {1}</p>'"
var1 = "'<p style=""""margin: 0px; font-weight: normal;""""><img src=""""http://images.mysite.com/static/images/mark.gif"""" style=""""margin-left: -8px;"""">{1}</p>'"

how do you add this variable in to the page?
if you are setting innerText of some element then change it to innerHTML
or add as LiteralControl
this.Page.Contols.Add(new LiteralControl(var1))