CommandEventArgs Constructors

Definition

Initializes a new instance of the CommandEventArgs class.

Overloads

CommandEventArgs(CommandEventArgs)

Initializes a new instance of the CommandEventArgs class with another CommandEventArgs object.

CommandEventArgs(String, Object)

Initializes a new instance of the CommandEventArgs class with the specified command name and argument.

CommandEventArgs(CommandEventArgs)

Initializes a new instance of the CommandEventArgs class with another CommandEventArgs object.

C#
public CommandEventArgs(System.Web.UI.WebControls.CommandEventArgs e);

Parameters

e
CommandEventArgs

A CommandEventArgs that contains the event data.

Examples

The following example demonstrates how to create and initialize a new instance of the CommandEventArgs class using the specified CommandEventArgs object.

C#
void Command_Button_Click(Object sender, CommandEventArgs e)
{
    CommandEventArgs args = new CommandEventArgs(e);
}

Remarks

Use this constructor to create and initialize a new instance of the CommandEventArgs class using the specified CommandEventArgs object.

When an instance of CommandEventArgs is created by a call to this constructor, the following properties are initialized to the specified values.

Property Initial Value
CommandName The e.CommandName parameter.
CommandArgument The e.CommandArgument parameter.

See also

Applies to

.NET Framework 4.8.1 and other versions
Product Versions
.NET Framework 1.1, 2.0, 3.0, 3.5, 4.0, 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8, 4.8.1

CommandEventArgs(String, Object)

Initializes a new instance of the CommandEventArgs class with the specified command name and argument.

C#
public CommandEventArgs(string commandName, object argument);

Parameters

commandName
String

The name of the command.

argument
Object

A Object that contains the arguments for the command.

Examples

The following example demonstrates how to create and initialize a new instance of the CommandEventArgs class using the specified command name and argument.

C#
private void Command_Button_Click(Object sender, CommandEventArgs e)
{
    CommandEventArgs args2 = new CommandEventArgs("Sort", "Descending");
}

Remarks

Use this constructor to create and initialize a new instance of the CommandEventArgs class using the specified command name and argument.

When an instance of CommandEventArgs is created by a call to this constructor, the following properties are initialized to the specified values.

Property Initial Value
CommandName The value of the commandName parameter.
CommandArgument The value of the argument parameter.

See also

Applies to

.NET Framework 4.8.1 and other versions
Product Versions
.NET Framework 1.1, 2.0, 3.0, 3.5, 4.0, 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8, 4.8.1