How to use Literal Control in asp.net

Literal and Label control are same except that Literal Control does not allow you to apply a style to the displayed Text.

1.File-> New-> Website->  ASP.NET Web Site(Visual C#) -> Ok

(Now You will see a Default.aspx page. To create your own page->click on dropdown list below Edit->click Add new item->Select Web Form->click Add)

2.Click ToolBox-> Double Click on Literal(or drag and drop Literal on Design view)->change Literal Text Property to "Literal Test"

3.Click ToolBox-> Double Click on Button->change Button Text Property to "Click to change text"
asp.net Literal Control
Your design Window should look like this
 4.Double Click on the Button to get the code behind and write this code
5.Click F5->ok
Literal Control in asp.net
After Running the project



















Literal Control Text change programmatically
After Clicking the Button (Literal text is changed)

No comments:

Post a Comment