|
| 1 | +@page "/" |
| 2 | + |
| 3 | +<div class="control_wrapper"> |
| 4 | + <SfListBox DataSource="@Games" TValue="string[]" TItem="GamesData"> |
| 5 | + <ListBoxFieldSettings Value="ID" Text="Name"> |
| 6 | + </ListBoxFieldSettings> |
| 7 | + </SfListBox> |
| 8 | + |
| 9 | + @*Remote Data Source code snippet*@ |
| 10 | + @*<SfListBox TValue="string[]" TItem="EmployeeData"> |
| 11 | + <ListBoxFieldSettings Value="EmployeeID" Text="FirstName"> |
| 12 | + </ListBoxFieldSettings> |
| 13 | + <SfDataManager Url="https://ej2services.syncfusion.com/production/web-services/api/Employees" |
| 14 | + Adaptor="Syncfusion.Blazor.Adaptors.WebApiAdaptor" |
| 15 | + CrossDomain=true> |
| 16 | + </SfDataManager> |
| 17 | + </SfListBox>*@ |
| 18 | +</div> |
| 19 | + |
| 20 | + |
| 21 | + |
| 22 | +@code { |
| 23 | + |
| 24 | + //Remote Data Source code snippet |
| 25 | +
|
| 26 | + //public class EmployeeData |
| 27 | + //{ |
| 28 | + // public int EmployeeID { get; set; } |
| 29 | + // public string FirstName { get; set; } |
| 30 | + // public string Designation { get; set; } |
| 31 | + // public string Country { get; set; } |
| 32 | + //} |
| 33 | +
|
| 34 | + public class GamesData |
| 35 | + { |
| 36 | + public string ID { get; set; } |
| 37 | + public string Name { get; set; } |
| 38 | + } |
| 39 | + |
| 40 | + List<GamesData> |
| 41 | + Games = new List<GamesData> |
| 42 | + { |
| 43 | + new GamesData() { ID= "Game1", Name= "Badminton" }, |
| 44 | + new GamesData() { ID= "Game2", Name= "Basketball" }, |
| 45 | + new GamesData() { ID= "Game3", Name= "Cricket" }, |
| 46 | + new GamesData() { ID= "Game4", Name= "Football" }, |
| 47 | + new GamesData() { ID= "Game5", Name= "Golf" }, |
| 48 | + new GamesData() { ID= "Game6", Name= "Hockey" }, |
| 49 | + new GamesData() { ID= "Game7", Name= "Tennis"}, |
| 50 | + }; |
| 51 | + } |
| 52 | + |
| 53 | + <style> |
| 54 | + .control_wrapper { |
| 55 | + width: 250px; |
| 56 | + margin-left: 35%; |
| 57 | + margin-right: 35%; |
| 58 | + margin-top: 12%; |
| 59 | + margin-bottom: 15%; |
| 60 | + } |
| 61 | + </style> |
0 commit comments