|
@using Syncfusion.Blazor.Data
@using Syncfusion.Blazor.DropDowns
<SfDropDownList TValue="string" TItem="EmployeeData" Placeholder="Select a customer" Query="@Query">
<DropDownListTemplates TItem="EmployeeData">
<ItemTemplate>
<span><span class='name'>@((context as EmployeeData).FirstName)</span><span class='destination'>@((context as EmployeeData).Designation)</span></span>
</ItemTemplate>
<ValueTemplate>
<span>@((context as EmployeeData).FirstName) - @((context as EmployeeData).Designation)</span>
</ValueTemplate>
</DropDownListTemplates>
<SfDataManager Url="https://ej2services.syncfusion.com/production/web-services/api/Employees" Adaptor="Syncfusion.Blazor.Adaptors.WebApiAdaptor" CrossDomain="true"></SfDataManager>
<DropDownListFieldSettings Text="FirstName" Value="FirstName"></DropDownListFieldSettings>
</SfDropDownList>
@code {
public class EmployeeData
{
public string FirstName { get; set; }
public string Designation { get; set; }
}
public Query Query = new Query();
}
<style>
.destination {
right: 15px;
position: absolute;
}
</style>
|