updatecommand()
cancelcommand()
editcommand()
deletecommand()
这些事件都可以!看你是怎样设置linkbutton的commandname属性!

解决方案 »

  1.   

    你可以在html代码里写,如:<asp:LinkButton runat="server" OnClick="delete" Text="delete" />
     
    public void delete(Object sender,EventArgs e)
    {
    //your code
    }
      

  2.   

    <asp:datagrid id=DataGrid1 style="Z-INDEX: 101; LEFT: 23px; POSITION: absolute; TOP: 221px" runat="server" 
    DataKeyField="au_id" DataSource="<%# view %>" Height="270px" Width="679px" 
    OnUpdateCommand="DataGrid1_Update" OnCancelCommand="DataGrid1_Cancel" OnEditCommand="DataGrid1_Edit" 
    OnDeleteCommand="DataGrid1_Delete" BorderColor="Blue" OnItemCommand="Item_Click" AllowSorting="True" 
    OnSortCommand="DataGrid1_Sort" AllowPaging="True" OnPageIndexChanged="DataGrid1_Page" BackColor="#C0FFFF">
        <AlternatingItemStyle BackColor="White"></AlternatingItemStyle>
        <HeaderStyle BackColor="Wheat"></HeaderStyle>
        <Columns>
            <asp:EditCommandColumn ButtonType="LinkButton" UpdateText="Update" CancelText="Cancel" EditText="Edit">
    </asp:EditCommandColumn>
            <asp:ButtonColumn Text="Delete" CommandName="Delete"></asp:ButtonColumn>
            <asp:ButtonColumn Text="Select" CommandName="SelectItem"></asp:ButtonColumn>
        </Columns>
    </asp:datagrid>
      

  3.   

    OnDeleteCommand="DataGrid1_Delete"protected void DataGrid1_Delete(Object sender, DataGridCommandEventArgs e) 
    {
    ...........//
    }
      

  4.   

    BigVictor(沉)说的对,那样写就对了!!
      

  5.   

    按linkbutton会出发datagrid中的itemcommand事件
    你可以用e.commandname来区分是谁发出的
      

  6.   

    你可以建一个ButtonColumn然后CommandName="delete" 这是关键
    那你就可以用DataGrid的DeleteCommand时间来做了