我是在后台创建的buttoncolumn
Dim tempBoundColumn As BoundColumn
        Dim tempButtonColumn As ButtonColumn        Dim i As Integer        For i = 0 To UBound(arrColumns)
            tempBoundColumn = New BoundColumn
            tempBoundColumn.DataField = "column" & i
            tempBoundColumn.HeaderText = arrColumnName(i)
            tempBoundColumn.ItemStyle.Wrap = False
            tempBoundColumn.ItemStyle.HorizontalAlign = HorizontalAlign.Left
            tempBoundColumn.HeaderStyle.Wrap = False            '将需要隐藏的列设置为visable=false
            If arrOnShow(i).ToLower = "no" Then
                tempBoundColumn.Visible = False
            End If
            datagridList.Columns.Add(tempBoundColumn)
        Next        tempButtonColumn = New ButtonColumn
        'tempButtonColumn.HeaderText = "修改"
        tempButtonColumn.Text = "修改"
        tempButtonColumn.CommandName = "update"
        tempButtonColumn.ItemStyle.Wrap = False
        tempButtonColumn.ItemStyle.HorizontalAlign = HorizontalAlign.Left
        'tempBoundColumn.HeaderStyle.Wrap = False
        datagridList.Columns.Add(tempButtonColumn)        tempButtonColumn = New ButtonColumn
        'tempButtonColumn.HeaderText = "删除" 
        tempButtonColumn.Text = "删除"
        tempButtonColumn.CommandName = "delete"
        tempButtonColumn.ItemStyle.Wrap = False
        tempButtonColumn.ItemStyle.HorizontalAlign = HorizontalAlign.Left
        'tempBoundColumn.HeaderStyle.Wrap = False
        datagridList.Columns.Add(tempButtonColumn)
但是ItemCommand事件一点反应也没有,为什么啊
哪位大虾告诉一下啊!!

解决方案 »

  1.   

    Private Sub datagridList_ItemCommand(ByVal source As Object, ByVal e As System.Web.UI.WebControls.DataGridCommandEventArgs) Handles datagridList.ItemCommand不是的,在点分页按钮的时候该事件时相应的,只是我自己创建的列不响应
      

  2.   

    参考我对一个类似问题的答复http://community.csdn.net/Expert/topic/4342/4342425.xml?temp=.5078546
      

  3.   

    his.Button_seal.Click += new System.EventHandler(this.Button_seal_Click);
    事件需要触发。才会响应。
      

  4.   

    VB中的Private Sub datagridList_ItemCommand(ByVal source As Object, ByVal e As System.Web.UI.WebControls.DataGridCommandEventArgs) Handles datagridList.ItemCommand
    等同于
    this.Button_seal.Click += new System.EventHandler(this.Button_seal_Click);
    不时这个问题啊
    哎!!
      

  5.   

    将delete和update的第一个字母大写。试试。
      

  6.   

    wantaodyc(藏马) 
    按照你说的,那为什么在点分页按钮的时候该事件响应呢?
      

  7.   

    这个问题我也遇到过,你在html页<asp:datagrid    >里加上onitemcommand=""    ""中填写你在后台的那个函数名就行。