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

时间:2010-10-14 12:07:59

标签: c# asp.net gridview rowcommand

来自德国的一个美好的下午,

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

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()之后,特定的行无法执行。

THX
马克

1 个答案:

答案 0 :(得分:0)

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