it depends on how you're setting the datasource for the gridview. If you are using a datasource control, such as a SqlDataSource or EntityDataSource, and you have them configured to handle deletion of data then you should be good to go. The gridview will automatically try to use the delete function defined by the datasource. If you are manually setting the datasource for the gridview then you can use the gridview's RowCommand event and handle the CommandName "Delete" ("Update" for edit) in the code behind.
protected void GridView1_RowCommand(object sender, GridViewCommandEventArgs e)
{
if (e.CommandName == "Delete")
{
}
}
Your gridview should look something like this:
<asp:gridview id="GridView1"
onrowcommand="GridView1_RowCommand"
runat="server" // Rest of gridview