RadzenDropDown with Multiple Values

Hello,

I get this error in the design editor:
image

Dropdown is setup as:

<RadzenDropDown @bind-Value="@(user.SelectedLocations)" style="display: block; width: 100%"  ValueProperty="LocationId" TextProperty="Description" Data="@locations" Multiple="true" AllowClear="true" Name="PermissionLocation"/>

user.SelectedLocations is

public partial class User
    {
        [NotMapped]
        public IEnumerable<int> SelectedLocations
        {
            get
            {
                return !string.IsNullOrEmpty(Locations) ? Locations.Split(',').Select(l => int.Parse(l)) : Enumerable.Empty<int>();
            }
            set
            {
			   Locations = string.Join(",", value);
			}   
        }

    }

When the application runs it's working correctly. Is this just a visual issue in the UI or is there a workaround?

Hi @ken.stoner,

The problem is that Radzen Blazor Studio generates sample data for the Locations property (which is the string Locations). Your code tries to convert it to a list of integers which fails. The solution would be to use the C# preprocessor and hide this implementation from Radzen Blazor Studio:

        [NotMapped]
        public IEnumerable<int> SelectedLocations
        {
            get
            {
#if RADZEN
                return Enumerable.Empty<int>();
#else
                return !string.IsNullOrEmpty(Locations) ? Locations.Split(',').Select(l => int.Parse(l)) : Enumerable.Empty<int>();
#endif
            }
            set
            {
               Locations = string.Join(",", value);
	    }   
        }

Thank you that worked.

As always, thank you for your support and a great product!