asp.net.ph

CommandEventArgs.CommandArgument Property

System.Web.UI.WebControls Namespace   CommandEventArgs Class


Retrieves the argument for the command.

Syntax


Script [ Object variable = ] CommandEventArgs.CommandArgument

Property Value


variable A System.Object that contains the argument for the command.

The property is read only with no default value.

Remarks

The CommandArgument can contain any string set by the programmer. The CommandArgument property complements the CommandName property by allowing to provide any additional information for the command, to identify the CommandArgument in code and perform the approprate tasks.

Example

The following example demonstrates how to access the CommandArgument property to determine supplemental information for the command to perform.

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

CommandEventArgs Members   Button.CommandArgument   ImageButton.CommandArgument   LinkButton.CommandArgument 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