newbie question, how do I put a " in my coding ...

T

THY

Hi,

a newbie question here, I got a label ...
I want to have something like label.text = "<font
color="#000000">test</font>"

but it won't work since the " will end the statement ...

please help, thanks ...
 
M

MS News \(MS ILM\)

single quote? or split into = "<font color=" + """" + "#000000" + """" +
">test</font>" etc.
depends. or '"'
 
T

THY

I need to have more than 1 color in that label ...
<font color="#ffffff">a<font><font color="#ffffff">b<font>
 
M

MS News \(MS ILM\)

Well repeat the process
"<font color=" + """" + "#ffffff" + """" + ">a</font><font color=" + """" +
"#bbbb" + """" + ">b</font>"
etc..
 
J

Jeremy

I'm not sure if your main goal is to set the font of the
text or not, but if it is that's not how you do it.

You can either set it in the HTML when you make your label
like:
<asp:Label id="LabelID" runat="server" Font-
Names="Verdana" Font-Size="Small" ForeColor="Black" />

Or in the VB code like:
LabelID.ForeColor = System.Drawing.Color.Red

Then if you wanted to add your text it would be something
like:
LabelID.Text = "Hellow World!"

But so far I've never needed to put a double-quote in a
label, so I'm not really sure how to do that.. Maybe
something like:

LabelID.text = "<font color="""#000000""">text</font>"

But I don't know...

Hope this helps,
Jeremy
 
J

Jeremy

Sorry, didn't see the other replies when I posted my first
reply. Guess I should have refreshed the page before I
replied...

Anyway, you could try placing all of the labels into a
placeholder, set their colors independently and just worry
about the text that goes in each of the labels you need.

Jeremy
 
T

THY

ah, this is cool ... thanks for it ...

by the way, I found out you dont have to put the + ...
just make it "" and it will auto become " on output ...

thanks for it ... : )
 
M

MS News \(MS ILM\)

Good job


THY said:
ah, this is cool ... thanks for it ...

by the way, I found out you dont have to put the + ...
just make it "" and it will auto become " on output ...

thanks for it ... : )
 
J

Jerry Hammond

Hi,

a newbie question here, I got a label ...
I want to have something like label.text = "<font
color="#000000">test</font>"

but it won't work since the " will end the statement ...

please help, thanks ...

This might help:

Label1.Text="<font color='"#00ce69"'>";
Label1.Text="TEST!";
Lable1.Text="</font>;

Best,
Jeery
 
J

John Saunders

Ok (you didn't mention that!).

But you shouldn't use <font>. Instead use <span
style="color=#000000">x</span>. <font> is deprecated.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,768
Messages
2,569,574
Members
45,051
Latest member
CarleyMcCr

Latest Threads

Top