Go Back   Velocity Reviews > Newsgroups > ASP Net
User Name
Password
Register FAQ Members List Calendar Search Today's Posts Mark Forums Read

Reply

ASP Net - Literal control - why?

 
Thread Tools Search this Thread
Old 06-10-2004, 01:18 PM   #1
Default Literal control - why?


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.




VB Programmer
  Reply With Quote
Old 06-10-2004, 01:40 PM   #2
Kevin Spencer
 
Posts: n/a
Default Re: Literal control - why?
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" <I-Hate-> wrote in message
news:ehe$...
> 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.
>
>





Kevin Spencer
  Reply With Quote
Old 06-10-2004, 01:48 PM   #3
Raterus
 
Posts: n/a
Default Re: Literal control - why?
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" <I-Hate-> wrote in message news:ehe$...
> 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.
>
>



Raterus
  Reply With Quote
Old 06-10-2004, 02:38 PM   #4
Ignacio Machin \( .NET/ C# MVP \)
 
Posts: n/a
Default Re: Literal control - why?
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" <I-Hate-> wrote in message
news:ehe$...
> 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.
>
>





Ignacio Machin \( .NET/ C# MVP \)
  Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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

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

Similar Threads
Thread Thread Starter Forum Replies Last Post
How to control the height of a Drop down control Siri_y Software 1 05-17-2009 06:19 AM
Mind Control and CIA'S BOURNE IDENTITY PLOT soleilmavis@gmail.com DVD Video 2 08-03-2007 09:54 PM
Ajax Atlas not working in User Control faiq Software 0 09-16-2006 08:28 AM
Charter Communications -- mind control Laura DVD Video 0 01-28-2006 03:14 AM
FS: JP1 cable to program your universial remote control, now youcan control anything you want! Mike DVD Video 0 07-15-2005 02:46 AM




SEO by vBSEO 3.3.2 ©2009, Crawlability, Inc.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46