|
<div class="form-control">
<SfMultiSelect @bind-Value="mylist" TValue="string[]" TItem="MyModel" ShowSelectAll=true SelectAllText="@selectAll" UnSelectAllText="@unSelectAll" Mode="VisualMode.CheckBox" Placeholder="@placeholder" DataSource="@MyDatasource" AllowFiltering="true">
<MultiSelectFieldSettings Text="Description" Value="Id"></MultiSelectFieldSettings>
<MultiSelectEvents TValue="string[]" TItem="MyModel"></MultiSelectEvents>
</SfMultiSelect>
</div>
@code {
private List<MyModel> MyDatasource;
private string[] mylist = new string[] { };
protected override async Task OnInitializedAsync()
{
MyDatasource = await ownservice.GetRecordKeepingChemicals();
mylist = new string[] { "1", "2" };
}
} |
|
<SfDialog Width="250px" ShowCloseIcon="true" IsModal="true" @bind-Visible="@IsVisible">
<DialogEvents OnOpen="Open"></DialogEvents>
<DialogTemplates>
<Content>
@if (shouldShow)
{
<SfMultiSelect @ref="multiselectObj" Placeholder="e.g. Australia" @bind-Value="@MultiVal" DataSource="@Country" Mode="VisualMode.CheckBox">
<MultiSelectFieldSettings Value="Code" Text="Name"></MultiSelectFieldSettings>
</SfMultiSelect>
}
</Content>
</DialogTemplates>
<DialogButtons>
<DialogButton Content="OK" IsPrimary="true" OnClick="@CloseDialog" />
<DialogButton Content="Cancel" OnClick="@CloseDialog" />
</DialogButtons>
</SfDialog>
@code {
SfMultiSelect<string[],Countries> multiselectObj { get; set; }
public string[] MultiVal { get; set; } = new string[] {"AU","BM" };
public Boolean shouldShow { get; set; } = false;
private bool IsVisible { get; set; } = false;
public void Open()
{
shouldShow = true;
}
|