62,046
社区成员
发帖
与我相关
我的任务
分享
<asp:Button ID="Button1" CommandName="踢" CommandArgument="足球" runat="server" Text="Button" OnClick="Button_Click" />
<asp:Button id="Button2" CommandName="打" CommandArgument="篮球" Text="动作2" runat="server" OnClick="Button_Click" />
protected void Button_Click(Object sender, EventArgs e)
{
string argName = ((Button)sender).CommandName;
string argArg = ((Button)sender).CommandArgument;
Label1.Text = "您选中的动作为:<font color=red>" + argName + "</font>,动作目标是:<font color=red>" + argArg + "</font>";
}