ButtonColumn.CommandName Property

Gets or sets a string that represents the command to perform when a button in the System.Web.UI.WebControls.ButtonColumn object is clicked.

Namespace: System.Web.UI.WebControls
Assembly: System.Web (in system.web.dll)

public:
virtual property String^ CommandName {
	String^ get ();
	void set (String^ value);
}
/** @property */
public String get_CommandName ()

/** @property */
public void set_CommandName (String value)

public function get CommandName () : String

public function set CommandName (value : String)

Property Value

A string that represents the command to perform when a button in the ButtonColumn is clicked. The default is an empty string ("").

Use the CommandName property to associate a command name, such as Add or Remove, with a button. You can set the CommandName property to any string that identifies the action to perform when a button in the System.Web.UI.WebControls.ButtonColumn object is clicked. Then, you can determine programmatically the command name in the event handler for the ItemCommand event and perform the appropriate actions.

The value of this property is stored in view state.

The following code example demonstrates how to use the CommandName property to associate a command name with a button. Then, the command name of the clicked button is determined programmatically in the event handler for the ItemCommand event and the appropriate action is performed.

No code example is currently available or this language may not be supported.

Windows 98, Windows 2000 SP4, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition

The .NET Framework does not support all versions of every platform. For a list of the supported versions, see System Requirements.

.NET Framework

Supported in: 2.0, 1.1, 1.0

Community Additions

ADD
Show: