protected void GridProdCategery_RowCommand(object sender, GridViewCommandEventArgs e) { if (e.CommandName == "EditPcategory") { pcid = long.Parse(e.CommandArgument.ToString()); List <ProductCategories> lstcat = objprocat.GetProductCategoryDetails(pcid); Session["Pcid"] = pcid; foreach (ProductCategories item in lstcat) { TextPcname.Text = item.ProductCategoryName; TextDesc.Text = item.Description; } mpeUpdate.Show(); } else if (e.CommandName == "DeletePcategory") { pcid = long.Parse(e.CommandArgument.ToString()); long res = objproduct.DeleteProduct(pcid); if (res > 0) { objpp.DeleteProductpic(pcid); objprocat.DeleteProductCategory(pcid); BindGrid(); DivMsg.Style.Add("display", "inline-table"); lblMsg.Text = "Deleted Successfully !"; } else { DivMsg.Style.Add("display", "inline-table"); lblMsg.Text = "Cannot Delete Product Catgory !!"; } } }
protected void GridView1_RowDeleting(object sender, GridViewDeleteEventArgs e) { GridViewRow row = GridView1.Rows[e.RowIndex]; //string s = GridView1.Rows[e.RowIndex].Cells[0].Text; Label lblno = (Label)row.FindControl("lblsmno"); long smid = long.Parse(lblno.Text); string id = GridView1.DataKeys[e.RowIndex].Value.ToString(); long pid = long.Parse(id); pcobj.ProductCategoryID = pid; spobj.ProductCategoryID = pid; spobj.SpecificationCategoryID = smid; pcobj.DeleteProductCategory(pid); spobj.DeleteSpecificationCategory(); // binddata(); BindSpecData(); }