gpt4 book ai didi

c# - GridView 中的 RowCommand 在单击时引发多个事件

转载 作者:太空宇宙 更新时间:2023-11-03 16:51:10 25 4
gpt4 key购买 nike

来自德国的美好下午,

我在带有 RowCommand 事件的行上有一个 asp:GridView 和 ButtonFields。

protected void gridView_RowCommand(object sender, GridViewCommandEventArgs e)
{
switch (e.CommandName)
{
case "FirstButton":
this.DoSomething();
break;
case "SecondButton":
this.DoSomethingElse();
break;
}
this.BindDataGrid();
}

我的问题出现在超过 90% 的情况下,当我点击 ButtonField 时,此事件会引发两次。问题是在我执行 this.DoSomething()this.DoSomethingElse() 之后,特定行无法再次执行。

谢谢
马克

最佳答案

为什么调用 this.BindDataGrid?如果没有这个,你的解决方案就不能工作吗?这将导致第二次运行 rowcommand。

关于c# - GridView 中的 RowCommand 在单击时引发多个事件,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/3932894/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com