literal or label for error message

G

Guest

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

Guest

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

Guest

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/library(d=robot)/sz4949ks.aspx
 

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

Forum statistics

Threads
473,744
Messages
2,569,483
Members
44,901
Latest member
Noble71S45

Latest Threads

Top