Join the DZone community and get the full member experience.Join For Free
Consider the following .ASPX grid code:
<asp:GridView ID="GridView1" runat="server" AutoGenerateDeleteButton="true" AutoGenerateColumns="false" AutoGenerateEditButton="True" onrowcancelingedit="GridView1_RowCancelingEdit" onrowdeleting="GridView1_RowEditing" onrowupdating="GridView1_RowUpdating" onrowdatabound="GridView1_RowDataBound" <Columns> <asp:BoundField DataField="EMPID" HeaderText="EmployeeID" /> <asp:BoundField DataField="FirstName" HeaderText="FirstName" /> <asp:BoundField DataField="LastName" HeaderText="LastName" /> <asp:BoundField DataField="Address" HeaderText="Address" /> </Columns>> </asp:GridView>Now as you can see in the above snippet, AutoGenerateDeleteButton="true" is true, which means that you can now see a button to delete a record directly from the grid. However, it would be great to ask the user whether he wants to delete the record or not.
Published at DZone with permission of Pranay Rana , DZone MVB. See the original article here.
Opinions expressed by DZone contributors are their own.