ASP.NET GridView Delete button does not work?

  • Thread starter Thread starter Xantos
  • Start date Start date
X

Xantos

Guest
I have a delete button in my gridview control and when I try to run it it dosent seem to call the function.


<asp:GridView ID="grid" runat="server" AutoGenerateColumns="False"
DataKeyNames="eisEquipSerialNum" onrowdeleting="grid_RowDeleting">
<Columns>
<asp:BoundField DataField="eisType" HeaderText="Type"
SortExpression="eisType" />
<asp:BoundField DataField="eisEquipSerialNum" HeaderText="Serial Number"
SortExpression="eisEquipSerialNum" />
<asp:BoundField DataField="eisDescription" HeaderText="Description"
SortExpression="eisDescription" />
<asp:ButtonField ButtonType="Button" CommandName="Delete" Text="Delete" />
</Columns>
</asp:GridView>

protected void grid_RowDeleting(object sender, GridViewDeleteEventArgs e)
{

// Get the ID of the record to be deleted
string id = grid.DataKeys[e.RowIndex].Value.ToString();
// Execute the delete command
FoodServiceAccess.dEquipInStore(custNum, id);
// Reload the grid
grid.DataSource = FoodServiceAccess.sEquipInStore(custNum);
grid.DataBind();
}
 
Back
Top