Select form |
This sample uses the Select control to filter records returned to the form. |
Loading...
Loading...
Razor code
var categorySelect = new SelectModel(DataSourceType.SQLite, "FormNorthwind(sqlite)", "Categories") { Caption = "Categories", Searchable = true, Layout = LayoutType.Row };
categorySelect.Columns = new List() {
new SelectColumn("CategoryId"),
new SelectColumn("CategoryName")
};
var productForm = new FormModel(DataSourceType.SQLite, "FormNorthwind(sqlite)", "Products") { Insert = true, Delete = true, ToolbarPosition = ToolbarPosition.Bottom, Caption = "Products" };
productForm.Columns = new List() {
new FormColumn("ProductID","ID"),
new FormColumn("ProductName", "Name"),
new FormColumn("SupplierID","Supplier") { Lookup = new Lookup("Suppliers", "SupplierId", "CompanyName"),Required = true },
new FormColumn("CategoryID","Category") { Lookup = new Lookup("Categories", "CategoryID", "CategoryName"),Required = true, ForeignKey = true },
new FormColumn("QuantityPerUnit", "Qty"){ InitialValue = 0},
new FormColumn("UnitPrice", "Price") {Required = true,InitialValue = 0, MinValue = 0, MaxValue = 100 },
new FormColumn("UnitsInStock", "Stock") {Required = true,InitialValue = 0, MinValue = 0 },
new FormColumn("UnitsOnOrder", "On Order") {Required = true,InitialValue = 0 },
new FormColumn("ReorderLevel", "Re-order Level") {Required = true,InitialValue = 0, MaxValue = 50 },
new FormColumn("Discontinued") {DataType = typeof(bool), InitialValue = true}
};
categorySelect.LinkedControl = productForm;
@(await new DbNetSuiteCore.Control(HttpContext).Render(categorySelect))
<hr />
@(await new DbNetSuiteCore.Control(HttpContext).Render(productForm))