<asp:LinkButton id="Toptip" runat="server" CssClass="red" Text="推荐" CommandName="Cancel">推荐</asp:LinkButton>|
<asp:LinkButton id="Update" runat="server" CssClass="red" Text="修改" CommandName="Update"></asp:LinkButton>|
<asp:LinkButton id="Delete" runat="server" CssClass="red" Text="删除" CommandName="Delete"></asp:LinkButton>
CommandName!!!!!!!!!!!!

解决方案 »

  1.   

    在后台写上对应的事件
    Delete对应[ObectName]_DeleteCommand
    Update对应[ObectName]_UpdateCommand
    Cancel对应[ObectName]_CancelCommand
      

  2.   

    CommandName写上对应事件的名字
    delete----Rowdeleting
    update----RowUpdating
    edit------RowEditing
    Cancel----RowCancelingEdit
      

  3.   

    感谢cangyuewuhen() 的解,请问能否说的稍微详细些,新手刚接触,请多多包涵
      

  4.   

    你是用的自己写的代码绑定的数据,还是使用了SqlDataSource ?
      

  5.   

    Dim myCommand As New OdbcCommand    Dim A_ID As Integer = GridView1.DataKeys(e.RowIndex).Value----得到这一行的主键值    sqlStr = "delete XXX  where A_ID=" & A_ID    myCommand.Connection = gConn
        myCommand.CommandText = sqlStr
        myCommand.ExecuteNonQuery()
        如果想删除后马上看到删除效果,建议写个绑定方法!
      

  6.   

    Datekeynames这个属性要写上你表的主键列名称这些是最简单的方法了
      

  7.   

    哦 那个commtext的我会写 主要我就是不会得到当前点了删除这一行的信息 是哪一个字段做为where的判断 谢谢大家的答案 我去试试
      

  8.   

    你选中GridView,点右键选属性,在点击事件(就是那个闪电)里面有RowDeteling 双击OK!~
      

  9.   

    分也不多 问题简单 回答的都对……接个分吧? 
    你选中GridView,点右键选属性,在点击事件(就是那个闪电)里面有RowDeteling 双击OK!
    直接绑定DataSource代码都省了
      

  10.   

    我是这样写的
    protected void GridView1_RowDeleting(object sender, GridViewDeleteEventArgs e)
        {
            this.GridView1.DeleteRow(this.GridView1.SelectedIndex);
        }
    不过好象还是不对
      

  11.   

    int i=GridView1.GridView1.DataKeys(e.RowIndex).Value
    就行了,但是gridview的Datekeynames这个属性要写上你表的主键列名称
      

  12.   

    this.GridView1.DeleteRow(Convert.ToInt32( this.GridView1.DataKeyNames["ClassStudentID"]));
    郁闷 问题处理很久都没搞定谁能帮帮我啊 给我个完整的程序
    万分感谢。