This constraint cannot be enabled as not all values have corresponding parent values This constraint cannot be enabled as not all values have corresponding parent values asp.net asp.net

This constraint cannot be enabled as not all values have corresponding parent values


By default, when you create a relationship, it enforces foreign key constraints, by setting to false, you are telling it that you dont want to enforce the relationship.

ds1.DataRelation.Add(“relCustOrder”, parentCol, childCol, false)

The solutions is to set constraint in DataRelation class to false


use the subquery in select statements to control the related rows.It is gonnna work.


I resolved my issue by adding a missing table entry. I use to build menu tree from sql server table.

You too must be missing an entry in table

some childCol is getting NULL