Share via


Label Class

Provides control capability to represent a label control for displaying text on a mobile device.

public class System.Web.UI.MobileControls.Label : 
   System.Web.UI.MobileControls.TextControl

Remarks

The Text property, which is inherited from the TextControl class, provides the string that is rendered as the label.

Example

The following example uses two labels, one on each Form object. The first label is not modified, and thus does not require an identifier (ID). The second label ID is "WelcomeMessage" and the Button_OnClick event handler activates its form.

<%@ Page Inherits="System.Web.UI.MobileControls.MobilePage" 
   Language="VB" %>
<%@ Register TagPrefix="mobile"
    Namespace="System.Web.UI.MobileControls"
    Assembly="System.Web.Mobile" %>

<script language="vb" runat="server">
Public Sub Button_Click(sender As Object, e As EventArgs)
    WelcomeMessage.Text = "Welcome, " + NameEdit.Text + "!"
    ActiveForm = SecondForm
End Sub
</script>

<mobile:Form runat="server">
  <mobile:Label runat="server">Enter your name</mobile:Label>
  <mobile:TextBox runat="server" id="NameEdit" />
  <mobile:Command runat="server" id="Button" OnClick="Button_Click">
        OK
  </mobile:Command>
</mobile:Form>

<mobile:Form runat="server" id="SecondForm">
  <mobile:Label runat="server" id="WelcomeMessage" />
</mobile:Form>
[C#]
<%@ Page Inherits="System.Web.UI.MobileControls.MobilePage" 
   Language="c#" %>
<%@ Register TagPrefix="mobile"
    Namespace="System.Web.UI.MobileControls"
    Assembly="System.Web.Mobile" %>

<script language="c#" runat="server">
public void Button_Click(Object sender, EventArgs e) 
{
    WelcomeMessage.Text = "Welcome, " + NameEdit.Text + "!";
    ActiveForm = SecondForm;
}
</script>

<mobile:Form runat="server">
  <mobile:Label runat="server">Enter your name</mobile:Label>
  <mobile:TextBox runat="server" id="NameEdit" />
  <mobile:Command runat="server" id="Button" OnClick="Button_Click">
        OK
  </mobile:Command>
</mobile:Form>

<mobile:Form runat="server" id="SecondForm">
  <mobile:Label runat="server" id="WelcomeMessage" />
</mobile:Form>

Requirements

Namespace: System.Web.UI.MobileControls

Assembly: System.Web.Mobile

See Also

Label Control | Form Class | TextControl Class