473,396 Members | 1,917 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,396 software developers and data experts.

literal or label for error message

Hi;

I have some error messages I have to create (can't use the validators). I
have done this using both labels and literals - is there any reason to prefer
one over the other?

Note: We are localizing the error messages in resource files.

--
thanks - dave
david_at_windward_dot_net
http://www.windwardreports.com

Mar 9 '06 #1
2 1551
The Literal control is only a reserved place in memory to add to its controls
collection any other control. The text that saved in the Text property of
the Literal will rendered as is (i.e. without any enclosed HTML tag). The
Label control on the other hand renders a specific HTML object tag named
<span>. This difference means that you cannot style a literal control unless
you style its contents but the label control has attributes such as CssClass
to allow you to style the <span> tag.
--
HTH,
Phillip Williams
http://www.societopia.net
http://www.webswapp.com
"David Thielen" wrote:
Hi;

I have some error messages I have to create (can't use the validators). I
have done this using both labels and literals - is there any reason to prefer
one over the other?

Note: We are localizing the error messages in resource files.

--
thanks - dave
david_at_windward_dot_net
http://www.windwardreports.com

Mar 9 '06 #2
The Literal control is only a reserved place in memory to add to its controls
collection any other control. The text that is saved in the Text property of
the Literal will be rendered as is (i.e. without any enclosing HTML tag).
The Label control on the other hand renders a specific HTML object tag named
<span>. This difference means that you cannot style a literal control unless
you style its contents but the label control has attributes such as CssClass
to allow you to style the <span> tag. For a reference you might read this
article from the MSDN:

http://msdn2.microsoft.com/en-us/lib.../sz4949ks.aspx

--
HTH,
Phillip Williams
http://www.societopia.net
http://www.webswapp.com
"David Thielen" wrote:
Hi;

I have some error messages I have to create (can't use the validators). I
have done this using both labels and literals - is there any reason to prefer
one over the other?

Note: We are localizing the error messages in resource files.

--
thanks - dave
david_at_windward_dot_net
http://www.windwardreports.com

Mar 9 '06 #3

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

Similar topics

1
by: dale zhang | last post by:
Hi, I have a web form page. it has gridlayout and a table at top like a template. When I have the literal or requiredfieldvalidator ErrorMsg displayed, they are all over the page. Is there...
7
by: les | last post by:
I'm new to asp.net. (refugee from old asp) I have a database field "Website", which is a url and I want it be a hyperlink. I can display the url as text using: <asp:literal id="litWebsite"...
6
by: Joe | last post by:
I know that the Literal control will not render a <span> tag so I can not format its text. Other than this, what is the difference betwen the Literal control and the LiteralControl Control? How...
2
by: David Thielen | last post by:
We have a status message we display that can be good news (in green) or bad news (in red). Is there a way to do this for a single literal or label? Or do we need to have two, one set to green and...
5
by: George Jordanov Ivanov | last post by:
All, Today I was playing with Literal control. Basically it is more or less like the Label control with this difference that Literal control is something like "lightweight" text container (that...
2
by: Mark A. Sam | last post by:
Hello, I want to use a literal control to provide information about people listed on a webpage, where the control is on the same line as the person it addresses, so that I have a button, the...
5
by: paul.hester | last post by:
Hi all, I have a custom control with an overridden Render method. Inside this method I'm rendering each control in its collection using their RenderControl method. However, I'm running into a...
4
by: shapper | last post by:
Hello, What control should I use when displaying some text? A Literal or a Label? Considerer I want to display some text and apply a CSS class to it. I can do it in 2 ways: ...
9
by: Bob M | last post by:
If I define an expression or equation, how can I retrieve that expression as string literal? I want to do this so that I could avoid repetitive typing (or copy/paste/change) the same thing at two...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
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
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
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
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
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,...

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.