473,406 Members | 2,847 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,406 software developers and data experts.

Regarding custom controls - To add align property to label.

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..

Mar 15 '07 #1
2 2294
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!
*********************************************
<sw*************@yahoo.co.inwrote in message
news:11**********************@p15g2000hsd.googlegr oups.com...
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..
Mar 15 '07 #2
Thanks a lot...
I got it. I am able to achieve it using style.add()

Mar 16 '07 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: Sanjay Pais | last post by:
I built a custom control for all the basic web.ui.controls like textbox, label, checkbox etc etc. I added my custom attribute called ApplySecurity to the html in the page. However, when I cycle...
10
by: everett | last post by:
I am dynamically creating labels. I would like to be able to attach custom properties(?) to the labels so that I can query the property for the data in it later. Is this possible, and how do I...
4
by: Robert | last post by:
I've created a custom control that inherits System.Windows.Forms.UserControl. It consists of three labels next to each other. I am able to access the control's properties and methods, but none...
1
by: Robert | last post by:
This is the code for the custom control: Public Class SPCLabel Inherits System.Windows.Forms.UserControl #Region " Windows Form Designer generated code " Public Sub New() MyBase.New()
1
by: Buddy Ackerman | last post by:
I don't know what the problem is. I have a form with several controls that need to be validated, I put a validation group in every form control, every validatoino control, the submit button and...
1
by: Jeremy Chapman | last post by:
I have a property will an array of webcontrols. The control features a custom property editor which can add and remove web controls to the array, but how do I persist the informtion by...
0
by: Jeremy Chapman | last post by:
I have included below virtually all the code to a control I'm trying to build. My issue is that an array list property in my control does not get persisted properly to the aspx page code in design...
0
by: chandrasekhar | last post by:
Hi I have developed a web page with some controls. I put all of them in session variables. I passed this values in the page. When an user enter some data in form fields and click the buttton ,...
4
by: =?Utf-8?B?UmljaEI=?= | last post by:
I am trying to create a project using the ASP.NET AJAX accordion control. I would like to dynamically add panes to the control with a form template added when the pane is added. I have tried...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.