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:
property String^ CommandName {
	virtual String^ get();
	virtual 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
Available since 1.1
Return to top
Show: