前台:
<asp:TemplateField HeaderText="操作">
<ItemTemplate>
<asp:Button ID="btDelete" runat="server" CommandName="toDelete" Text="删除" Height="18px" CssClass="btn" />
</ItemTemplate>
<ItemStyle Width="4%" HorizontalAlign="Center" Wrap="False" />
</asp:TemplateField>
后台:
if (e.CommandName == "toDelete")
{
//更新数据或者直接将数据从数据库中删除
} |