|
4 | 4 | @using System.ComponentModel.DataAnnotations; |
5 | 5 | @using System.ComponentModel; |
6 | 6 |
|
7 | | -<SfGrid TValue="OrderDetails" DataSource="@Orders" Toolbar="@(new List<string>() { "Edit", "Update", "Cancel" })"> |
| 7 | +<SfGrid TValue="Order" DataSource="@Orders" Toolbar="@(new List<string>() { "Edit", "Update", "Cancel" })"> |
8 | 8 | <GridEditSettings AllowEditing="true" /> |
9 | 9 | </SfGrid> |
10 | 10 |
|
11 | 11 | @code |
12 | 12 | { |
13 | | - public List<OrderDetails>? Orders { get; set; } |
| 13 | + public List<Order>? Orders { get; set; } |
14 | 14 | protected override void OnInitialized() |
15 | 15 | { |
16 | 16 | base.OnInitialized(); |
17 | 17 | Orders = Enumerable.Range(1, 10).Select(x => new OrderDetails() |
18 | 18 | { |
19 | 19 | OrderID = 10240 + x, |
20 | | - CustomerName = new string[] { "VINET", "TOSMP", "HANAR", "VICTE" }[new Random().Next(4)], |
| 20 | + Name = new string[] { "VINET", "TOSMP", "HANAR", "VICTE" }[new Random().Next(4)], |
21 | 21 | Freight = new float[] { 32.28f, 22.90f, 30.99f, 50.52f }[new Random().Next(4)], |
22 | 22 | ShipCity = new string[] { "Reims", "Munster", "Rio de Janeir", "Lyon" }[new Random().Next(4)], |
23 | 23 | OrderDate = DateTime.Now.AddDays(x), |
24 | 24 | }).ToList(); |
25 | 25 | } |
26 | | - public class OrderDetails |
| 26 | + public class Order |
27 | 27 | { |
28 | 28 | //Denotes one or more properties that uniquely identify an entity. |
29 | 29 | [Key] |
|
32 | 32 | public int? OrderID { get; set; } |
33 | 33 |
|
34 | 34 | [Display(Name = "CustomerName")] |
35 | | - public string? CustomerName { get; set; } |
36 | | - |
37 | | - //Specifies how data fields are displayed and formatted by ASP.NET dynamic data |
38 | | - [DisplayFormat(DataFormatString = "c2")] |
39 | | - public float Freight { get; set; } |
| 35 | + public string? Name { get; set; } |
40 | 36 |
|
41 | 37 | //Specifies whether the property this attribute is bound to be read only. |
42 | 38 | [ReadOnly(true)] |
43 | 39 | [Display(Name = "Ship City", AutoGenerateField = true, Order = 3)] |
44 | 40 | public string? ShipCity { get; set; } |
45 | 41 |
|
| 42 | + //Specifies how data fields are displayed and formatted by ASP.NET dynamic data |
| 43 | + [DisplayFormat(DataFormatString = "c2")] |
| 44 | + public float Freight { get; set; } |
| 45 | + |
46 | 46 | // Indicates whether the data field is editable. |
47 | 47 | [Editable(false)] |
48 | 48 | [Display(Name = "Order Date")] |
|
0 commit comments