How to by default auto select all values if the multiselect dropdown data source is from database/dynamic?
You need to set the Value property accordingly - create a collection of all values you need to be selected. This is the only way to (pre)select values in the DropDown.
For example if you use the ValueProperty setting you need a collection of all values e.g.
<RadzenDropDown Data=@data @bind-Value=@value Multiple="true" TextProperty="Text" ValueProperty="Value" />
value = data.Select(i => i.Value); //Createa a collection of all values (the Value property represents the "value" of an item)
If you don't set ValueProperty just create a copy of the data:
<RadzenDropDown Data=@data @bind-Value=@value Multiple="true" TextProperty="Text" />
value = data.ToList();
1 Like