diff --git a/blazor/datagrid/connecting-to-adaptors/custom-adaptor.md b/blazor/datagrid/connecting-to-adaptors/custom-adaptor.md index 0617e1667e..97f4f270ae 100644 --- a/blazor/datagrid/connecting-to-adaptors/custom-adaptor.md +++ b/blazor/datagrid/connecting-to-adaptors/custom-adaptor.md @@ -215,6 +215,24 @@ The following sample code demonstrates how to inject a service into the Custom A @code{ + + protected override void OnInitialized() + { + Orders = Enumerable.Range(1, 75).Select(x => new Order() + { + OrderID = 1000 + x, + CustomerID = (new string[] { "ALFKI", "ANANTR", "ANTON", "BLONP", "BOLID" })[new Random().Next(5)], // Randomly assigns a CustomerID. + Freight = 2.1 * x, + }).ToList(); + } + + public class Order + { + public int OrderID { get; set; } + public string CustomerID { get; set; } + public double Freight { get; set; } + } + // Custom adaptor class that extends the DataAdaptor class. public class CustomAdaptor : DataAdaptor { @@ -985,6 +1003,24 @@ The following sample code demonstrates how to implement CRUD operations for cust @code{ + + protected override void OnInitialized() + { + Orders = Enumerable.Range(1, 75).Select(x => new Order() + { + OrderID = 1000 + x, + CustomerID = (new string[] { "ALFKI", "ANANTR", "ANTON", "BLONP", "BOLID" })[new Random().Next(5)], // Randomly assigns a CustomerID. + Freight = 2.1 * x, + }).ToList(); + } + + public class Order + { + public int OrderID { get; set; } + public string CustomerID { get; set; } + public double Freight { get; set; } + } + // Custom adaptor implementation by extending the DataAdaptor class. public class CustomAdaptor : DataAdaptor {