protected void _Bu_Delete_Click(object sender, EventArgs e) { if (_GW_.SelectedIndex == -1) { _La_Status.Text = "Status : Failed No index was selected"; return; } int OID = int.Parse(_GW_.SelectedDataKey.Values["OrderID"].ToString()); int PID = int.Parse(_GW_.SelectedDataKey.Values["ProductID"].ToString()); _La_Status.Text = "Status : " + NorthwindAccess.DeleteOrderDetails(OID, PID); _GW_.DataBind(); _GW_.SelectedIndex = -1; }
protected void ButtonDelete_Click(object sender, EventArgs e) { //Get the orderID and productID of the selected item int orderID, productID; try { orderID = int.Parse(GridViewOrderDetails.SelectedDataKey.Values["OrderID"].ToString()); productID = int.Parse(GridViewOrderDetails.SelectedDataKey.Values["ProductID"].ToString()); } catch { return; } //Delete the row LabelStatus.Text = NorthwindAccess.DeleteOrderDetails(orderID, productID); //Update the gridview GridViewOrderDetails.DataBind(); }