Click here to Skip to main content
13,513,296 members
Rate this:
Please Sign up or sign in to vote.
See more:
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 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
Top Experts
Last 24hrsThis month

Advertise | Privacy |
Web04 | 2.8.180417.1 | Last Updated 21 Jan 2013
Copyright © CodeProject, 1999-2018
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