Conditional configuration

Docs

The OnRecordSelected event can be used to conditionally configure the form elements based on the data. In this example the form elements are disabled for product records that have the discontinued column set to true.

Razor
                                
                                        
DbNetEditCore productsForm = new DbNetEditCore("northwind", "products");
productsForm.Column("discontinued").DataType(typeof(Boolean));
productsForm.Bind(EventType.OnRecordSelected, "disableFormForInactiveProducts");
productsForm.Column("supplierid").Lookup(new Lookup("suppliers", "supplierid", "companyname")).Label("Supplier");
productsForm.Column("categoryid").Lookup(new Lookup("categories", "categoryid", "categoryname")).Label("Category");
productsForm.Column(new string[] { "ProductName", "Discontinued" }).Browse();
@productsForm.Render()