Click here to Skip to main content
11,640,297 members (62,529 online)
Rate this: bad
Please Sign up or sign in to vote.
See more: ASP.NET Controls
Hi, I am new at ASP.Net and I am wondering why we use literal. I read some documents and they say that literal's text value can be changed programatically but we can change a label's text property programatically too...

Like Label1.Text="anything";

So can you please explain me briefly, why and when we should use the literal control?

Thank you very much in advance.
Posted 20-Dec-12 0:15am
Rate this: bad
Please Sign up or sign in to vote.

Solution 1

Hi Arun ,

Go through the below thread

Rate this: bad
Please Sign up or sign in to vote.

Solution 2

The Label Control is used to place text which can be static or assigned, for which you can provide style by setting properties regarding its look which is unable for Literal Control.

But in Literal Control you can include the HTML code,in which you can explore its style .

The Literal control is used to display text; that is, it renders static text on a Web page without adding additional HTML tags. It passes content directly to the client browser unless you use the Mode property to encode the content.

It can be used to control the page title or button labels if requirement is dynamic.

This link demonstrates with illustration, check[^]
Arunprasath Natarajan at 28-Jan-13 9:22am
Tan q Madam

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
0 Mika Wendelius 240
1 CPallini 209
2 OriginalGriff 165
3 Sergey Alexandrovich Kryukov 139
4 F-ES Sitecore 120
0 Mika Wendelius 200
1 OriginalGriff 145
2 CPallini 115
3 jgakenhe 40
4 sasanka sekhar panda 30

Advertise | Privacy | Mobile
Web02 | 2.8.150731.1 | Last Updated 21 Jan 2013
Copyright © CodeProject, 1999-2015
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100