繁体   English   中英

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

[英]RowCommand in GridView raises multiple events on click

来自德国的一个愉快的下午,

我在具有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();
}

我的问题是,在我点击ButtonField的所有案例中,有90%以上是此事件引发的。 问题是在我执行this.DoSomething()this.DoSomethingElse() ,特定行无法被执行。

谢谢

你为什么叫this.BindDataGrid? 没有这个,您的解决方案将无法工作吗? 这将导致第二次执行rowcommand。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM