I\'ve searched in google there\'s an easy way to delete a record with confirmation using this code:
Please modify your markup and code to include the OnRowDeleting
event.
<asp:GridView OnPageIndexChanging="PendingRecordsGridview_PageIndexChanging" ID="PendingRecordsGridview" runat="server" AutoGenerateColumns="False" DataKeyNames="ID" OnRowcommand="PendingRecordsGridview_RowCommand" DataSourceID="sd1" BorderStyle="Ridge" BackColor="White" BorderColor="Black" BorderWidth="3px" CellPadding="4" Width="1070px" PageSize="2" AllowPaging="True">
<RowStyle ForeColor="#003399" HorizontalAlign="Center" OnRowDeleting="PendingRecordsGridview_RowDeleting"/>
On the code behind add this method.
public void PendingRecordsGridview_RowDeleting (Object sender, GridViewDeleteEventArgs e)
{
}
You are trying with a command name of Delete for your delete button. So the gridview creates a row deleting event automatically....
You need to change the command argument from Delete to something else like Delete_Product or whatever...