asp.net.ph

CommandEventArgs.CommandName Property

System.Web.UI.WebControls Namespace   CommandEventArgs Class


Retrieves the name of the command.

Syntax


Script [ String variable = ] CommandEventArgs.CommandName

Property Value


variable String specifying the name of the command to perform.

The property is read only with no default value.

Remarks

Use the CommandName property to determine the command to perform. The CommandName can contain any string set by the programmer. The programmer can then identify the command name in code and perform the appropriate tasks.

Example

The following example demonstrates how to access the CommandName property to determine the command to perform.

<script language = "C#" runat = "server">
   void myCommandEventHandler ( Object src, CommandEventArgs e ) {
      if ( e.CommandName == "Sort" )
         // ... insert code to sort.
      else
         // ... insert code to perform alternative.
   }
</script>
See Also

CommandEventArgs Members   Button.CommandName   ImageButton.CommandName   LinkButton.CommandName Skip Navigation Links




Previous page Back to top Next page

Check out related books at Amazon

© 2025 Reynald Nuñez and asp.net.ph. All rights reserved.

If you have any question, comment or suggestion
about this site, please send us a note