当网页上有多个 Button
控件时,请使用 CommandName
属性指定或确定与每个 Button
相关联的命令名称.控制.您可以使用任何标识要执行的命令的字符串来设置 CommandName
属性.然后,您可以以编程方式确定 Button
控件的命令名称并执行适当的操作.
When you have multiple Button
controls on a Web page, use the CommandName
property to specify or determine the command name associated with each Button
control. You can set the CommandName
property with any string that identifies the command to perform. You can then programmatically determine the command name of the Button
control and perform the appropriate actions.
(我的重点)
CommandArgument
:
一个可选参数以及相关的CommandName传递给Command事件.
An optional parameter passed to the Command event along with the associated CommandName.
...从事件对象(例如, e
)中检索为 e.CommandArgument
的
...which you retrieve from the event object (for instance, e
) as e.CommandArgument
.
例如,您可能有四个带有 CommandName
"DoSomething"的按钮,但是四个不同的 CommandArguments
告诉您的"DoSomething"代码该做什么或该做什么它来.您可能还具有 CommandName
="DoSomethingElse"的其他按钮,可以执行其他操作.:-)
So for instance, you might have four buttons with the CommandName
"DoSomething" but four different CommandArguments
telling your "DoSomething" code what to do, or what to do it to. You might also have other buttons with CommandName
= "DoSomethingElse" that, well, do something else. :-)
这篇关于控件示例按钮的命令名称和命令参数的用途是什么?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!