<EjsMultiSelect ref="@MultiSelectObj" ID="local" PlaceHolder="Select countries" DataSource="@localdata" Fields="@MultiSelectFieldSettings"></EjsMultiSelect>
EjsMultiSelect MultiSelectObj;
@functions{
protected override async Task OnAfterRenderAsync()
{
localdata = new List<object>
{
new { Name = "Australia", Code = "AU" },
new { Name = "Bermuda", Code = "BM" },
};
MultiSelectObj.DataSource = localdata;
MultiSelectObj.DataBind();
}
public object MultiSelectFieldSettings = new { text = "Name", value = "Code" };
} |
<EjsMultiSelect ref="@multiselect" PlaceHolder="Select countries" AllowCustomValue="true" DataSource="@localdata"> |
<input type="button" id="item" ref="multiselect" value="AddItem" onclick="@onClick" />
public void onClick(UIMouseEventArgs args)
{
this.multiselect.AddItem("newItem");
} |