Here is a sample approach :
Add this tag to your
ItemTemplate
section :
<asp:imagebutton id="ibDelete" runat="server" commandname="Delete" imageurl="images/del.gif" xmlns:asp="#unknown" />
and remember that your gridview
DataSource
should support
Delete
operation. Here is a sample datasource :
<asp:sqldatasource id="sdsCountry" runat="server" xmlns:asp="#unknown">
ConnectionString="<%$ ConnectionStrings:GConnectionString %>"
DeleteCommand="DELETE FROM [Country] WHERE [ID] = @original_ID">
<deleteparameters>
<asp:parameter name="original_ID" type="Int32" />
</deleteparameters>
</asp:sqldatasource>
Its clear that the Visual Studio will help you by its wizard to create a
DataSource
which supports all CRUD(Create, Read, Update, Delete) operations.