Created
May 10, 2020 12:03
-
-
Save KristianMariyanov/c5e7a3fb2869da6e5e1d844506956725 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<TelerikGrid Data=@GridData | |
Height=@Height | |
Sortable=true | |
Pageable=true> | |
<GridColumns> | |
<GridColumn Field=@nameof(Product.ProductId) Sortable="false" Title="Id" /> | |
<GridColumn Field=@nameof(Product.ProductName) Title="Product Name" /> | |
<GridColumn Field=@nameof(Product.UnitPrice) Title="Unit Price"> | |
<Template> | |
@(String.Format("{0:C2}", (context as Product).UnitPrice)) | |
</Template> | |
</GridColumn> | |
</GridColumns> | |
</TelerikGrid> | |
@code { | |
public IEnumerable<Product> GridData { get; set; } | |
string Height = "400px"; | |
protected override void OnInitialized() | |
{ | |
List<Product> products = new List<Product>(); | |
for (int i = 0; i < 100; i++) | |
{ | |
products.Add(new Product() | |
{ | |
ProductId = i, | |
ProductName = "Product " + i.ToString(), | |
SupplierId = i, | |
UnitPrice = (decimal)(i * 3.14), | |
UnitsInStock = (short)(i * 1), | |
}); | |
} | |
GridData = products.AsQueryable(); | |
} | |
public class Product | |
{ | |
public int ProductId { get; set; } | |
public string ProductName { get; set; } | |
public int? SupplierId { get; set; } | |
public decimal? UnitPrice { get; set; } | |
public short? UnitsInStock { get; set; } | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment