【问题标题】:RowCommand in GridView raises multiple events on clickGridView 中的 RowCommand 在单击时引发多个事件
【发布时间】:2010-10-14 12:07:59
【问题描述】:

来自德国的美好下午,

我在带有 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() 之后,特定的行无法再次执行。

谢谢
马克

【问题讨论】:

标签: c# asp.net gridview rowcommand


【解决方案1】:

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

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2012-01-19
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多