- c - 在位数组中找到第一个零
- linux - Unix 显示有关匹配两种模式之一的文件的信息
- 正则表达式替换多个文件
- linux - 隐藏来自 xtrace 的命令
为什么下面的代码会导致以下错误:
System.Web.UI.WebControls.Button.OnCommand(System.Web.UI.WebControls.CommandEventArgs)' 由于其保护级别而无法访问
protected void btnSearch_Click(object sender, EventArgs e)
{
...
UpdatePanel updatePanel;
...
Button moreButton = new Button();
moreButton.ID = "moreButton";
moreButton.Text = "More";
updatePanel.ContentTemplateContainer.Controls.Add(moreButton);
moreButton.CommandName = "More";
moreButton.CommandArgument = department.ID + "|department";
moreButton.OnCommand += new CommandEventHandler(getMoreInfoCommand_Click);
...
updatePanelList.Add(updatePanel);
}
protected void getMoreInfoCommand_Click(Object sender, CommandEventArgs e)
{
}
最佳答案
你应该使用
moreButton.Command += new CommandEventHandler(getMoreInfoCommand_Click);
OnCommand
是一个 protected 方法,而Command
是一个公共(public)事件。
关于c# - Button.OnCommand += new CommandEventHandler 结果保护级别错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/13768131/
我的问题是我有一个简单的 Minecraft 插件,我只想让它执行一个命令。我以前做过命令,所以步骤对我来说很清楚。我的plugin.yml 设置正确(服务器检测我添加的命令并显示它的帮助页面等),并
我有一个页面,其中列出了数据网格中的一堆项目。 每个项目都有一个对应的删除链接按钮,用于从列表中删除该项目。在我的事件处理程序中——项目被删除的地方——我检查该项目是否是列表中的最后一项。如果它是最后
我正在为 Minecraft 创建一个简单的插件,它可以切换命令并为目标玩家提供唯一的 UUID。然而,public boolean onCommand 方法声明它从未被使用过。 主类(Freeze.
我在对我的项目 (ASP.NET Web Forms) 进行一些研究时遇到了 2 种看起来相似的事件类型,OnCommand 和 OnClick。我已通读 MSDN 页面,但仍不清楚它们之间的区别。
在运行具有以下内容的 Chrome 扩展程序时,我收到错误“未捕获的类型错误:无法读取未定义的属性‘onCommand’”: list .json: { "name": "Test", "de
我正在尝试做一些看起来相当简单的事情。我有一个带有多个 LinkButtons 的用户控件。每个 LinkButton 都有 OnCommand、CommandName 和 CommandAr
为什么下面的代码会导致以下错误: System.Web.UI.WebControls.Button.OnCommand(System.Web.UI.WebControls.CommandEventAr
本文整理了Java中com.zsmartsystems.zigbee.zcl.clusters.ZclOnOffCluster.onCommand()方法的一些代码示例,展示了ZclOnOffClus
我正在尝试找到在 macOS 上将 NSMenuItem 与 SwiftUI onCommand 连接的最佳解决方案。 目前我正在做以下事情: 在 AppDelegate 中,我创建了一个虚拟函数,以
我已经阅读了数十篇有关此问题的帖子并尝试了所有这些,但没有运气,我不确定我错过了什么,这是 gridview 代码:
所以我现在正在尝试制作一个 Minecraft 插件,并且我已经制作了我的代码,其中大部分都是完美的,但是由于某种原因,一旦编写完成,我就会从 Eclipse 收到错误消息(标题) . 代码在这里找到
我试图从 bootstrap.js 文件调用 changePassword() 方法,但我不知道如何.. Bootstrap.js 位于项目文件夹的根目录,options.xul 位于 ./chrom
我有以下代码,在我正在开发的新扩展中: (.addListener js/chrome.alarms.onAlarm (fn [alarm] (.log js/console alarm))) (.a
我是一名优秀的程序员,十分优秀!