Home / ASP.NET Wiki / HTML / Web Controls / Label

Label

 Rate It (0)

A Label control allows you to add text to your web page.  Unlike a Literal control, a Label control supports various properties such as CssClass, ForeColor and Font that allow you to style the text that will be rendered. The Label control can also add html tags within the text property of the control.

To provide the ability to style the rendered text, the Label control renders the text assigned to its Text property wrapped in a span tag.  The span tag is where the style attributes are applied.  Although the addition of the span tag to the rendered markup adds only a small amount of additional bytes for each Label control, these extra bytes can start to add up if you are using Label controls inside of other repeating controls such as a GridView.  

If you are not intending to use the styling capabilities of the Label control and simply need a control that can render basic text then you may wish to consider using a Literal control as it will result in slightly less markup being rendered in your page.

 

Revision number 3, Monday, February 16, 2009 8:00:32 AM by shahed.kazi

Comments

Related Articles

jQuery autocomplete custom styling

Recently I have come across a situation where I need to customize the UI of jQuery UI autocomplete plugin. For reference I am adding the plugin resource as below-http://jqueryui.com/demos/autocomplete/Now if we look into the dynamic HTML generated while typing

AJAX Required Field Validator

Ajax ValidatiorIn this Article I'll Show you How to call a RequiredFieldValidator With the aid of AJAX.Step1:- In this case,there are three controls in .aspx page1.TextBox(txtfname)2.Label (lblmsg) :-To show the Error Message.3.and a Button(btnshow)asp

Control.ViewStateMode Property

View state is where the status of the page is saved when it is submitted to the server. View state is saved as hidden controls, within the form. View state stores value of each page controls as Base64 encoded strings. We can make a page not to store view state

Shortcuts

Table of Contents

Top Wiki Contributors

(last 30 days)

  1. francissvk (1)
  2. deepeshsp (1)