<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="Default.aspx.cs" Inherits="GRIDVIEW_DELETE_MULTIPLE_RECORDS_USING_CHECKBOX._Default" %> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" > <head runat="server"> <title>Untitled Page</title> <script type="text/javascript"> function confirmondelete(item) { if(confirm("would you like to delete selected item(s)?")==true) return true; else return false; } </script> </head> <body> <form id="form1" runat="server"> <asp:GridView ID="GridView1" runat="server" AutoGenerateColumns="False" onrowdatabound="GridView1_RowDataBound" onselectedindexchanged="GridView1_SelectedIndexChanged" > <columns> <asp:TemplateField> <HeaderTemplate> <asp:Button ID="ButtonDelete" runat="server" Text="Delete"/> </HeaderTemplate> <itemtemplate> <asp:CheckBox ID="CheckBox1" runat="server" /> </itemtemplate> <asp:BoundField DataField="EmpID" HeaderText="EmpID" ReadOnly="True" /> <asp:BoundField DataField="EmpName" HeaderText="EmpName" /> <asp:BoundField DataField="Address" HeaderText="Address" /> <asp:BoundField DataField="Phone" HeaderText="Phone" /> <asp:BoundField DataField="Salary" HeaderText="Salary" /> <asp:BoundField DataField="Country" HeaderText="Country" /> </columns> <div> </div> </form> </body> </html>
CommandName
if(e.CommandName=="delete") { //code here }
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)