在 Gridview中加了一列 当CommandName 自己命名为“Delete”和“Edit”时,系统会自动找默认的RowDeleting或者RowEditing方法,注意啦!
<asp:TemplateField HeaderText="操作" > <ItemTemplate> <asp:ImageButton CommandName = "Delete1" CommandArgument ="<%# GridView1.Rows.Count %>" ID="ImageButton1" runat="server" ImageUrl="~/images/del.gif" /> <asp:ImageButton CommandName = "Edit1" CommandArgument ="<%# GridView1.Rows.Count %>" ID="ImageButton2" runat="server" ImageUrl="~/images/edit.gif" /> </ItemTemplate> <HeaderStyle ForeColor="black" Width="100px"/> </asp:TemplateField>