PhoneCall Control

The PhoneCall control is an easy, text-based, output-only control that is used to represent a phone number to call. For devices that support placing phone calls, such as cell phones, the PhoneCall control is presented as an interactive element that when activated, makes a call. On other devices, the phone number is displayed as text, with an optional hyperlink.

Mobile Controls Syntax

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

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

   AlternateFormat="alternateText"
   AlternateURL="targetURL"
   PhoneNumber="phoneNumber">
   SoftKeyLabel="softKeyLabel">

innerText
</mobile:PhoneCall>

Constructors

Constructor Description
PhoneCall Initializes a new instance of the PhoneCall class.

Properties

Property Description
(Base control properties) The properties defined in Base Mobile Control Properties.
AlternateFormat Formatting string for the text value of the PhoneNumber property. This is used only for devices that are unable to initiate phone calls from Web content. The default value is {0} {1}, where {0} is the value of the Text property, and {1} is the value of the PhoneNumber property.
AlternateURL When this property contains a value other than null, the control renders the value in the AlternateFormat property as an anchor. If this anchor is activated, the control browses to the URL specified in the AlternateURL property. This is used for devices that are unable to initiate phone calls from Web content. The default value is null.
PhoneNumber Sets or returns a string that represents a phone number (required). For information about the formats that you can use in the string, see the PhoneNumber property.
SoftKeylabel Sets or returns the label used for the command when it is displayed on a soft key. The default value is an empty string.
Text (inherited from TextControl class) Specifies the text for a control to be rendered for devices that can initiate phone calls. The default value is Phone Number. The Text property can be specified through the Text attribute, or as inner text. If the Text property is specified in both ways, the inner text takes precedence. However, if the Text property is programmatically set, the inner text is automatically removed and the newly set property takes precedence.

Containment Rules

The following controls can contain a PhoneCall control.

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

The PhoneCall control cannot contain any other controls.

Device Templates

None.

Device-Specific Behavior

The following table describes the behavior of the PhoneCall control, which depends on the ability of the target device to initiate phone calls from Web content.

Device capability Description of behavior
Devices with telephony capability On devices that support programmatically placing phone calls, the control's text is displayed as a command. Invoking that command dials the phone number or presents the user with a number of options for dialing the phone number (some cell phones automatically do the latter). If the text field is not defined, the PhoneNumber property is used.

The rendering behavior in this case is identical to that of a Link control for the specified device.

Devices without telephony capability On other devices, the AlternateFormat property is treated as a formatting string that generates the text for display.

The PhoneCall control displays the phone number based on the value of the AlternateURL property. When the AlternateURL property contains null, the PhoneCall control renders the number in the same way as the Label control for the specified device. When the AlternateURL property contains a value other than null, the PhoneCall control renders the number in the same way as the Link control for the specified device.

Example

The following example contains a single form with a single PhoneCall control placed on it.

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

<mobile:Form runat="server">
   <mobile:PhoneCall runat="server" 
      AlternateFormat="{0} at {1}"
      AlternateURL="https://www.microsoft.com"
      phoneNumber="425-555-0187">Microsoft Corporation
   </mobile:PhoneCall>
</mobile:Form>

See Also

Control Reference | PhoneCall Class | PhoneCall Class Members | PhoneNumber Property