Jump to content
Xtreme .Net Talk

Recommended Posts

Posted

OK this is such a small thing why is it so hard!!

 

an ASp:label control how can i center align the text from the .vb code...

 

if you do it on the control itself its easy..

 

 <asP:label style='text-align:center;' blablabla /> 

 

sorted its works fine but as soon as i try do it from code it doesnt work? does any one know how to do this?

 

have tried alot of ways...

 
lblError.Style("text-align") = "center"
lblError.Style("textalign") = "center"
lblError.Style("align") = "center"

 

 

once again...HEEELP!! :D

Posted
nope doesnt work, im not sure if maybe asp tags have different attribute names or something? its very odd because it works if you dont dont do it programatically?
  • *Experts*
Posted

Have you tried using Attributes.Add in this manner?

 

lblError.Attributes.Add("style", "text-align:center;")

"Being grown up isn't half as fun as growing up

These are the best days of our lives"

-The Ataris, In This Diary

Posted

Labels evaluate to a <span> tag, which is just a container around the "text" inside, so there is no alignment

 

use a server-side div tag instead...

If you make it idiot proof, they'll build a better idiot :-)

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...