Dependent lookups


Lookups can be configured to be dependent or filtered based on another column in the form. To do this simply include a filter in the lookup SQL that uses a parameter with the same name as the column upon which it depends. In this example the city lookup is dependent on the selected country which is in turn dependent on the selected region.

DbNetEditCore customersEdit = new DbNetEditCore("northwind", "customers");
customersEdit.Columns = new List() { "CustomerId", "CompanyName", "Address", "Region", "Country", "City", "Phone", "Fax" };
customersEdit.Insert = true;
customersEdit.Column("country").Lookup(new Lookup("select distinct country from customers where region = @region"));
customersEdit.Column("city").Lookup(new Lookup("select distinct city from customers where country = @country"));