Tuesday, January 13, 2015

Working with ASP.NET label and literal control

Today we show tutorial on how to work with ASP.NET's Label and Literal controls.



Label and Literal controls of ASP.NET are used to display text on web page.


  • Literal Control:

The literal control can only be used to display text that doesn't require any special formatting. Literal control does not support any of formatting that Label supports. This is just for very simple use.

Literal Properties:

  • Mode: Mode Property has 3 Values. These values have an effect on how text is displayed. 
    • Transform: If you add HTML tags in text field, it will transform text based on HTML tag.
    • PassThrough:It will pass all the tags and formatting through. 
    • Encode: This will ignore all HTML tags, and display them as text and not format text as per HTML tags.


Label Control:

Label control allows text to be formatted.  Label control renders its control in span tag. Hence, you can use Label tag as HTML tag, so you can place the content inside its tag rather then use text property.

You can use property window to change some properties of controls such as BackColor, ToolTip, BorderColor, Fonts, etc..

Label Properties: ID, Text



Please like, subscribe and share.

No comments:

Post a Comment

IndiBlogger - The Indian Blogger Community