Hi,
Try this:
In your client code:
<asp:TemplateField ItemStyle-HorizontalAlign="Center" HeaderText="Delete">
<HeaderTemplate>Delete</HeaderTemplate>
<ItemTemplate>
<asp:ImageButton ID="Imgdelete" runat="server"
ImageUrl="~/admin/Images/Delete.gif" ToolTip="Delete product"
onclick="Imgdelete_Click" OnClientClick="return confirm('Delete this record?');" />
</ItemTemplate>
<FooterTemplate></FooterTemplate>
</asp:TemplateField>
In your code behind:
protected void Imgdelete_Click(object sender, ImageClickEventArgs e)
{
GridViewRow row = (GridViewRow)Imgdelete.NamingContainer;
string productName = row.Cells[0].Text;
string quoteID = txtquoteid.Text;
cmd = new SqlCommand("Delete from Quote_pro_details where p_name='" +
productName + "' and Quote_ID='" + quoteID + "'", con);
}
Hope this could help:
Please remember to mark the replies as answers if they help and unmark them if they provide no help.
Regards,
Algem