我在datagrid模版列放了一个imagebutton 触发事件为expandNode
this.DataGrid1.ItemCommand += new System.Web.UI.WebControls.DataGridCommandEventHandler(this.expandNode);现在我在加了按钮列-编辑this.EmployeeDataGrid.EditCommand += new System.Web.UI.WebControls.DataGridCommandEventHandler(this.EmployeeDataGrid_EditCommand);this.EmployeeDataGrid.UpdateCommand += new System.Web.UI.WebControls.DataGridCommandEventHandlerthis.EmployeeDataGrid_UpdateCommand);.
.
.
可是当我运行时,在我点击 编辑按钮 时,先触发的事件时expandNode事件
也就是说,按任何按钮都回触发itemcommand事件 各位高人是怎样解决这个问题????

解决方案 »

  1.   

    在itemcommand判断e.CommandName,从而确定执行什么操作
      

  2.   

    按钮列:编辑-更新-取消 好像没有commandname
      

  3.   

    按钮列也有 commandname在属性生成器里应该可以看见
      

  4.   

    <asp:EditCommandColumn ButtonType="PushButton" UpdateText="更新" CancelText="取消" EditText="编辑"></asp:EditCommandColumn>
    没有把,找不到?
      

  5.   

    itemcommand事件是"发生事件时激发",只要你在控件中点击了命令按钮,那么它肯定被激发了,不管你是用什么按钮.
    这不是问题,也不用解决.你只需要到你按钮相关的事件过程中写代码即可.
    你是想解决什么问题?