Hello i have trouble with binding int multiple data to multiple values. I have this variable
IEnumerable multipleValues;
So im using this component
RadzenDropDown Disabled="@DisableArpDropDown" AllowClear="true" TValue="int"
LoadData=@LoadDataVirtualization AllowFiltering="true"
Data=@StudentList
TextProperty="Name"
@bind-Value=@multipleValues
Multiple="true"
ValueProperty="Id"
SelectedItemChanged=@(args => OnChange(args, "DropDown with multiple selection"))
My model is looks like that
public int? Id { get; set; }
public string Name { get; set; }
error CS1662: Cannot convert lambda expression to intended delegate type because some of the return types in the block are not implicitly convertible to the delegate return type
I found this link DropDown Multiple with integer value example is working fine for me but my component and code doesn't work i can't understand why.
Can you provide a complete example which reproduces the problem? Also please format your code according to the FAQ.
My variables are created like this
IEnumerable SelectedStudentIdList;
private List StudentList = new List();
I have this component
<RadzenDropDown Name="StudentDropdown" Disabled="@DisableStudentDropDown" AllowClear="true"
LoadData=@LoadDataVirtualization AllowFiltering="true"
Data=@(StudentList)
TextProperty="Name"
Multiple="true"
ValueProperty="Id"
@bind-Value="@SelectedStudentIdList"/>
My load data event is this
public async Task LoadDataVirtualization(LoadDataArgs args)
{
Console.WriteLine("Args:" + args.Filter);
StudentList = await StudentService.GetStudentList(args.Filter);
await InvokeAsync(StateHasChanged);
}
My errors are look like this
So story is im getting input value from user and that is args.Filter value. Im passing that value to api so its brings the related students. I want to select those students but bind their id to SelectedStudentIdList. After i select my students and click outside component this error shows up.
Unfortunately you neither formatted your code nor provided a complete example. I won't be able to assist.
1 Like
As @korchev said, it's impossible to really understand what's going on in your code, if you don't provide a full example and properly formatted code snippet.
However, I can see that the Id
in your model is a nullable int:
public int? Id { get; set; }
.
That's probably causing problems. I can't imagine why an "Id" should be nullable, so I think you should work your code around to make that property not nullable.
1 Like
Sorry for late answer but yes that was the source of the error. Im embarrassed stealing your time for asking a question like this. Actually i did not define these Models and variables so i asked myself why someone define Id as nullable
anyway thank you.