Groups | Blog | Home
all groups > asp.net > march 2007 >

asp.net : Regarding custom controls - To add align property to label.


swapna_munukoti NO[at]SPAM yahoo.co.in
3/14/2007 11:47:09 PM
Hi all,

I am new to asp.net. So, may be my question may be simple. But I am
feeling hard to achieve this.
I need to create a web custom label control, for which I have to
assign new property called "Align". It should have center,left and
right alignments.
I have created a label with this property and set that to textalign.
But it doesnt have center alignment. How can I get center alignment?

And pls tell me as to how to associate that property to the control.

Thanks in advance..
Cowboy (Gregory A. Beamer)
3/15/2007 9:21:25 AM
Try using CSS or inline styles to set the alignment. The style in question
is text-align.

If the label fails, as it renders to SPAN (should not, but if), switch to a
Panel control, add a LiteralControl to its Controls property, for the text,
and apply the text-align. Panel renders to DIV, which I am certain can
center align. Try option 1 first.

--
Gregory A. Beamer
MVP; MCP: +I, SE, SD, DBA

*********************************************
Think outside the box!
*********************************************
[quoted text, click to view]
swapna_munukoti NO[at]SPAM yahoo.co.in
3/16/2007 12:54:37 AM
Thanks a lot...
I got it. I am able to achieve it using style.add()
AddThis Social Bookmark Button