Proprietà CommandArgument
Imposta o restituisce l'argomento associato al comando nell'evento ItemCommand. Il valore predefinito è una stringa vuota ("").
public string CommandArgument {
get,
set
}
Ereditarietà
Di seguito sono elencate le classi di controlli mobili che ereditano la proprietà CommandArgument dalla classe CommandEventArgs di Web Form.
Classe ListCommandEventArgs | Classe ObjectListCommandEventArgs |
Esempio
Nell'esempio che segue viene illustrato come utilizzare la proprietà CommandArgument per visualizzare l'argomento del comando specificato, ovvero 70.
Sub cmd_OnItemCommand(sender As Object, e As CommandEventArgs)
Label1.Text = "Today's quote of " + e.CommandName + " is " + e.CommandArgument
Label2.Text = "Yestrday's quote of " + e.CommandName + " was " +(Convert.ToInt32(e.CommandArgument) - 5).ToString()
End Sub
<mobile:form id="myForm" runat=server Alignment=Center >
<mobile:command id="CmdMSFT" onItemCommand = "cmd_OnItemCommand"
CommandArgument="70" CommandName="MSFT" runat="server"
Text="MICROSOFT" />
</mobile:form>
[C#]
void cmd_OnItemCommand(object sender, CommandEventArgs e)
{
Label1.Text = "Today's quote of " + e.CommandName +
" is " + e.CommandArgument;"'"""
}
<mobile:form id="myForm" runat=server Alignment=Center >
<mobile:command id="CmdMSFT" onItemCommand = "cmd_OnItemCommand"
CommandArgument="70" CommandName="MSFT" runat="server"
Text="MICROSOFT" />
</mobile:form>
Vedere anche
Si applica a: classe Command