使用 CSharp,我没有在按钮单击时进入 (GridView1_RowDeleting) 函数。我不知道问题出在哪里,但浪费了很多时间。
默认.aspx
asp:GridView ID="GridView1" runat="server" OnRowDeleting="GridView1_RowDeleting"
AllowPaging="True">
<Columns>
<asp:TemplateField>
<ItemTemplate>
<asp:ImageButton ID="img1" runat="server" CommandName="GridView1_RowDeleting" ImageUrl="~/Images/cross.png" />
</ItemTemplate>
</asp:TemplateField>
</Columns>
</asp:GridView>
默认.aspx.cs
protected void GridView1_RowDeleting(object sender, GridViewDeleteEventArgs e)
{
}