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




Home
Suggested Reading


Previous page Back to top Next page

© 2000-2010 Rey Nuñez All rights reserved.

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

You can help support asp.net.ph