控件示例按钮的命令名称和命令参数的用途是什么? [英] what is the purpose of command name and command argument for a control example button?

查看:79
本文介绍了控件示例按钮的命令名称和命令参数的用途是什么?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

控件示例按钮的命令名称和命令参数的用途是什么?我们什么时候应该去呢?

what is the purpose of command name and command argument for a control example button? when should we go for this?

推荐答案

当网页上有多个 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屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆