How to get all selected items in a list box
<ListBoxEvents ValueChange="@onChange" TValue="List<Team>"/>
<ListBoxFieldSettings Text="TeamName" Value="Team"/>
<ListBoxSelectionSettings ShowCheckbox="true" ShowSelectAll="true"></ListBoxSelectionSettings>
<Syncfusion.Blazor.Lists.ListViewEvents TValue="Team"Selected="@OnSelection"></Syncfusion.Blazor.Lists.ListViewEvents>
</SfListBox>
{
public int Id { get; set; }
public string Description { get; set; }
public bool isPrivate { get; set; } = false;
public DateTime TimeCreated { get; set; } = DateTime.Now;
public int ProjectId { get; set; }
public Project Project { get; set; }
public List<TeamMember> TeamMembers { get; set; } = new List<TeamMember>();
}
{
Console.WriteLine("onChange");
//var cd = ((Newtonsoft.Json.Linq.JArray)args.Value).ToObject<List<Team>>()[0];
Newtonsoft.Json.Linq.JArray cd = args.Items as Newtonsoft.Json.Linq.JArray;
if (cd != null)
{
Console.WriteLine(cd.GetType());
var abc = cd.ToObject<List<Team>>();
Console.WriteLine(abc[0]);
}
}
|
<div class="col-lg-12 control-section">
<div id="listbox-control">
<h4>Select your favorite car:</h4>
<SfListBox DataSource="@Data" TValue="string[]" TItem="DataValues" @bind-Value="@Value"></SfListBox>
<br /> <br />
<h4> Selected Items </h4>
<br />
@{
foreach (string item in Value)
{
<div> @item </div>
}
}
</div>
</div>
@code{
public string[] Value = new string[] { "Hennessey Venom" };
} |
|
@using Syncfusion.Blazor.DropDowns
<SfListBox @ref="ListBoxObj" DataSource="@Vehicles" TValue="string[]" TItem="VehicleData" @bind-Value="@Value">
<ListBoxFieldSettings Text="Text" Value="Text" />
</SfListBox>
<button @onclick="Created">Click</button>
@code{
public string[] Value = new string[] { "Hennessey Venom" };
SfListBox<string[], VehicleData> ListBoxObj;
private void Created()
{
var Values = ListBoxObj.GetDataByValue(Value);
}
}
|
This should be in the documentation.
Hi Dan,
We will consider your request and update it in our online documentation site. This documentation will be refreshed in end of February.
Regards,
YuvanShankar A
Sorry for the delay, Dan.
Due to some technical issues, the list box UG documentation didn't refresh for this volume 1 main release. We will refresh the UG documentation for the list box by mid of April 2023. We appreciate your patience until then.
Hi Dan,
We have corrected the reported issue in our online UG documentation. Please check the below UG link for reference.
UG link: https://blazor.syncfusion.com/documentation/listbox/how-to/get-items
Please get back to us if you need further assistance.
Regards,
YuvanShankar A
This blazor.syncfusion.com page can’t be found
Hi David,
The Blazor Syncfusion demo sites are loading properly on our end. Please refer to the video demonstration and the demo link provided below. If you are still facing issues, please provide more details along with a video demonstration. Based on that information, we will check the issue and provide you with a prompt solution.
Demo link: https://blazor.syncfusion.com
Please let us know if you need any further assistance on this.
Regards,
KeerthiKaran K V
Attachment: screencapture_70b3d395.zip
- 12 Replies
- 7 Participants
-
DO Dodzi
- Aug 31, 2020 09:24 PM UTC
- Aug 23, 2024 11:23 AM UTC