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