Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > Literal control - why?

Reply
Thread Tools

Literal control - why?

 
 
VB Programmer
Guest
Posts: n/a
 
      06-10-2004
What's the real advantage to using a literal control over a simple label?
What are the pros/cons/typical usages for the literal control?

Thanks.


 
Reply With Quote
 
 
 
 
Kevin Spencer
Guest
Posts: n/a
 
      06-10-2004
A label renders a <span> tag. It allows you to programmatically change the
display characteristics of some text you want to display. A LiteralControl
renders exactly whatever static HTML you want it to. There is no general
advantage of using one over the other. One may be more useful than another
in certain circumstances. For example, if you want to display static text,
and make no programmatic changes to it, you might want to use a
LiteralControl.

--
HTH,
Kevin Spencer
..Net Developer
Microsoft MVP
Big things are made up
of lots of little things.

"VB Programmer" <(E-Mail Removed)> wrote in message
news:ehe$(E-Mail Removed)...
> What's the real advantage to using a literal control over a simple label?
> What are the pros/cons/typical usages for the literal control?
>
> Thanks.
>
>



 
Reply With Quote
 
 
 
 
Raterus
Guest
Posts: n/a
 
      06-10-2004
I think they only real difference is that it inherits from Control, not WebControl, so you can't apply a style to the text. It probably would be a bit faster to render in that aspect as well.

http://msdn.microsoft.com/library/de...classtopic.asp

And you can't do this with a label control, in one line..

someControl.controls.add(new LiteralControl("any text I want rendered"))

"VB Programmer" <(E-Mail Removed)> wrote in message news:ehe$(E-Mail Removed)...
> What's the real advantage to using a literal control over a simple label?
> What are the pros/cons/typical usages for the literal control?
>
> Thanks.
>
>

 
Reply With Quote
 
Ignacio Machin \( .NET/ C# MVP \)
Guest
Posts: n/a
 
      06-10-2004
Hi,


Usually I use a Literal to inject Javascript code to the client.

Cheers,

--
Ignacio Machin,
ignacio.machin AT dot.state.fl.us
Florida Department Of Transportation


"VB Programmer" <(E-Mail Removed)> wrote in message
news:ehe$(E-Mail Removed)...
> What's the real advantage to using a literal control over a simple label?
> What are the pros/cons/typical usages for the literal control?
>
> Thanks.
>
>



 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
What's the Difference between an asp:Literal control and an asp:Localize control? netcodedevil@gmail.com ASP .Net Web Controls 0 09-26-2007 11:12 AM
What's wrong with rpc-literal? Why use doc-literal? Anonieko Ramos ASP .Net Web Services 0 09-27-2004 09:06 AM
apply CSS on literal control? Jk ASP .Net 1 05-03-2004 05:23 PM
Literal Control with IFrame text, trying to remove from page without screen corruption NeilG ASP .Net 0 01-21-2004 10:49 AM
Re: Literal Control and Onclick? Mike Prager ASP .Net 0 10-14-2003 08:35 PM



Advertisments