This documentation is archived and is not being maintained.

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 Value

Type: System::String
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.

.NET Framework

Supported in: 4, 3.5, 3.0, 2.0, 1.1, 1.0

Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows XP SP2 x64 Edition, Windows Server 2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported with SP1 or later), Windows Server 2003 SP2

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