Example #1
0
    protected void gridView_RowDeleting(object sender, GridViewDeleteEventArgs e)
    {
        GridViewRow   row       = gridView.Rows[e.RowIndex];
        long          ProductId = long.Parse(row.Cells[2].Text.ToString());
        ProductWorker pw        = new ProductWorker();

        pw.DeleteProduct(ProductId);
        List <Product> products = (List <Product>)Session["Products"];

        products.Remove(products.Find(o => o.Id == long.Parse(row.Cells[2].Text.ToString())));
        Session.Add("Products", products);
        PopulateProducts(products);
    }