Once again, I've this scenario where I've an entity called Categories and I'm using it to create Categories (Parentid = null) and Subcategories (ParentID = Category Identifier). There is not a closed numbers of levels A sub can be another sub parent's.

I've got a delete button that is working just fine when I want to delete only a sub or a cat but i cant make it delete all the subcategories associated with that category or subcategory Id. I know i need to check the table for the current ID i'm deleting in first place but I don't know how.


Hi Carolina,

I would create a Delete Action that takes the Id of the record to delete. Inside the Action, retrieve all subcategories (via the ParentId). Loop over the result, and call the Delete Action recursively for each subcategory (passing the subcategory's Id). After the loop, delete the main record.

Thus, you delete all sub categories and their subcategories etc. of the given (sub)category.