Command

Command.NET 1.1, disposable

System.Web.UI.MobileControls (system.web.mobile.dll)class

The Command control renders as a command button or a link, depending on the device. Though the style differs depending on the device, the Text will always appear. The Command control plays the same role as the System.Web.UI.WebControls.Button on a full-blown web page, triggering a postback when selected and raising a server-side Click event. In addition, the ItemCommand will fire with additional information about the command in a System.Web.UI.WebControls.CommandEventArgs object. This information includes the System.Web.UI.WebControls.Button.CommandName and System.Web.UI.WebControls.Button.CommandArgument properties of the System.Web.UI.WebControls.Button. The ItemCommand event is useful when you are creating composite or data-bound controls that include buttons, because the event will is bubbled up to parent controls. If you do not need this functionality, you can simply handle the Click event. If the mobile device supports softkeys, you can set the label that will be used for the corresponding softkey through the SoftkeyLabel property. Otherwise, the Text property will be used for the label if it less than nine characters (or the label "Go" will be displayed if it is not).

You can set the CausesValidation property to determine whether page validation will be performed when the command is selected, before the Click or ItemCommand events fire.

public class Command : TextControl, System.Web.UI.IPostBackEventHandler, System.Web.UI.IPostBackDataHandler {
// Public Constructors
   public Command( );
// Public Instance Properties
   public bool CausesValidation{set; get; }
   public string CommandArgument{set; get; }
   public string CommandName{set; get; }
   public CommandFormat Format{set; get; }
   public string ImageUrl{set; get; }
   public string SoftkeyLabel{set; get; }
// Protected Instance Methods
   protected override bool IsFormSubmitControl( );                // overrides MobileControl
   protected virtual void OnClick(EventArgs e);
   protected virtual void OnItemCommand(System.Web.UI.WebControls.CommandEventArgs e)
   protected override void OnPreRender(EventArgs e);            // overrides MobileControl
// Events
   public event EventHandler Click;
   public event CommandEventHandler ItemCommand;
}

Hierarchy

System.Object System.Web.UI.Control(System.ComponentModel.IComponent, System.IDisposable, System.Web.UI.IParserAccessor, System.Web.UI.IDataBindingsAccessor) MobileControl(System.Web.UI.IAttributeAccessor) TextControl Command(System.Web.UI.IPostBackEventHandler, System.Web.UI.IPostBackDataHandler)

Returned By

System.Web.UI.MobileControls.Adapters.HtmlCommandAdapter.Control, System.Web.UI.MobileControls.Adapters.WmlCommandAdapter.Control



    Part I: Introduction to ASP.NET
    Part III: Namespace Reference
    Chapter 40. The System.Web.UI.MobileControls Namespace
    Chapter 42. The System.Web.UI.WebControls Namespace