Link Control

Creates a text-based, output-only control that represents a hyperlink to another Form control on a mobile page or an arbitrary URL.

On all devices, a link is rendered in such a way that the Text property is presented to the user. When the link is clicked, control immediately changes to the page in the specified NavigateURL property. If the Text property is not defined, the default of the link is the AlternateURL property.

Mobile Controls Syntax

Required properties, defaults, and code-featured elements are noted in bold type.

<mobile:Link
   runat="server"
   id="id"
   Font-Name="fontName"
   Font-Size="{NotSet|Normal|Small|Large}"
   Font-Bold="{NotSet|False|True}"
   Font-Italic="{NotSet|False|True}"
   ForeColor="foregroundColor"
   BackColor="backgroundColor"
   Alignment="{NotSet|Left|Center|Right}"
   StyleReference="styleReference"
   Text="Text"
   Wrapping="{NotSet|Wrap|NoWrap}"

   NavigateURL="relativeLink"
   SoftkeyLabel="softkeyLabel">
innerText
</mobile:Link>

Containment Rules

The following controls can contain a Link control.

Control Comments
System.Web.UI.MobileControls.Form Can contain any number of Link controls.
System.Web.UI.MobileControls.Panel Can contain any number of Link controls.

The Link control cannot contain any other controls.

Device Templates

None.

Device-Specific Behavior

Device language Description of behavior
HTML At run time, the Link control renders a link as a standard HTML <a> tag (anchor), unless it starts with the number symbol (#), in which case it is rendered as a postback event. A <br> tag (line break) follows the link.
WML In WML, a link generates markup similar to the following.

<a href="postbackinfo">TextProperty</a>

If the value of the link starts with a number symbol (#), it is rendered as a postback event. A <br> tag (line break) follows the link.

Example

The following example contains a single form that has a single link on it.

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

<mobile:Form runat="server">
  <mobile:Link runat="server" 
   NavigateURL="http://mobile.msn.com">My Favorite Mobile Site</mobile:Link>
</mobile:Form>

See Also

Link Class | Link Class Members | Control Reference