Share via


SoftkeyLabel Property (Command)

Sets or returns the label used when a softkey is displayed. The default value is an empty string ("").

public string SoftkeyLabel {
   get,
   set
}

Remarks

This property is used only for devices that support softkeys.

If this property is empty, the Text property of the control is used. If the Text property is empty or its length is less than 9, the Text property is used for the softkey label. Otherwise, the word Go (if it is a submit control command) is displayed.

The value of the SoftkeyLabel property is truncated to 12 characters (the standard maximum length of a softkey).

Example

The following example demonstrates how to use the SoftkeyLabel property.

Private Sub Page_Load(ByVal sender As System.Object, ByVal e As 
System.EventArgs) Handles MyBase.Load
     Dim currentCapabilities As MobileCapabilities =    
             CType(Request.Browser, MobileCapabilities) 
     If (currentCapabilities.MaximumSoftkeyLabelLength = 5) Then 
         Command1.SoftkeyLabel = "Click" 
     ElseIf (currentCapabilities.MaximumSoftkeyLabelLength > 5) Then 
         Command1.SoftkeyLabel = "Submit" 
     End If

End Sub

[C#]
public void Page_Load(Object sender, EventArgs e)
{
   MobileCapabilities currentCapabilities
      = (MobileCapabilities)Request.Browser;
   if (currentCapabilities.MaximumSoftkeyLabelLength == 5)
   {
     Cmd1.SoftkeyLabel = "Click";
   }
   else if (currentCapabilities.MaximumSoftkeyLabelLength > 5)
   {
     Cmd1.SoftkeyLabel = "Submit";
   }
}

See Also

Applies to: Command Class