| |||||||||||||
Button.CommandArgument PropertySystem.Web.UI.WebControls Namespace Button Class Sets or retrieves an optional parameter passed to the Command event along with the associated CommandName. Syntax
Property Value
The property is read/write with no default value. RemarksUse the CommandArgument property to specify an optional parameter that complements the CommandName property.
The CommandArgument property complements the CommandName property by allowing you to provide additional information about the action to perform when the Button is clicked. For example, multiple button controls with their CommandName properties set to Sort may have one CommandArgument property set to Ascending and the other Descending. This provides an easy way to determine the appropriate action to perform in your Command event handler. ExampleThe following example demonstrates how to set the CommandArgument property at design time, to create a Button control that sorts a list in ascending order. <form runat = "server">
<asp:button id = "myButton" runat = "server" text = "Sort"
commandname = "Sort"
commandargument = "Ascending"
onCommand = "getCommandArgs " />
</form>
The below example demontrates a Command event handler that, in this case, simply determines the event arguments passed to the handler when a Button is clicked.
See Also |
| ||||||||||||
Check out related books at Amazon
© 2000-2008 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 aspxtreme