Dropdowndatagrid issue

Hello team, I´m a new user with Radzen and I´m very happy with it but I´m having an issue with some dropdowndatagrid.

Why? I´ll try to show you:

I´ve got these required files:

and I have this code:

This works correctly. If I change the value of the first dropdown, the list of the second one is updated and if I select a value from the second dropdown, everything works fine.

The problem comes when I change the first dropdown (Center) and do not select any line by forgetting. Here the validator does not work anymore because the dropdown keeps the previously selected value.

Do you know what is the problem?

As far as I understand you have cascading lookups - the second one depends on the first. I see there is a Change event for the first DropDownDataGrid however I'm not sure what's the code - you should set to null the property bound to the second lookup value (pmsMsPuesto.IdLinea).

1 Like

First thing, Thank you so much for your answer. I appreciate very much. Second thing, my apologies for my english, I know that some times is difficult to understand it.

Ok, I undertstand you and I´m trying to do it, but I don´t know how can I do it.

I explain you... when I change the first dropdown (Name="Centro"), as you said, I call to the method "CambiarLinea" giving it the Id:

protected async Task CambiarLinea(object value)
{
pmsMsLineasForIdCentro = await APTService.GetPmsMsLineasPorCentro(new Query { Filter = $@"i => i.IdCentro == @0 && i.Activo == @1", FilterParameters = new object { value, true } });
}

Ok, this is working OK, because on the second dropdown the information is loaded correctly:

<RadzenDropDownDataGrid Data="@pmsMsLineasForIdCentro" TextProperty="Cod" ValueProperty="Id" AllowClear=true
Placeholder="Seleccione..." style="display: block; width: 100%"
@bind-Value="@cmsMsTurno.IdLinea" Name="IdLinea" />

The problem comes, when for example i´m creating a new register and I select one Center (first dropdown) and one Linea (second dropdown), but finally, imagine that I change the center... When I change the center, the new information about lines is loaded OK on the second dropdown but I don´t know if it´s the cache, because this control keeps the previous selected item (pmsMsPuesto.IdLinea)...

I have tried a lot of things but I cannot fix it... any idead that what can I do?

One more time, thanks a lot for your time and your support.

Have a nice day.

Regards,

Try to change this to:

<RadzenDropDownDataGrid Data="@pmsMsLineasForIdCentro.Where(i => true)" ...
1 Like

Hello Enchev, I don´t know if we will be able to find the solution, but thank you very much for your support.

I´ve just tried you indications, but I have an error when I try to EDIT:

Any other idea? I´m locked...

Thanks again.

This is null most probably, you can update the expression to:

Data="@(pmsMsLineasForIdCentro?.Where(i => true))"
1 Like

Hello again. Thanks for your answer. This time, I didn´t have the error but I had same issue with the second dropdown.

But don´t worry, this community is wonderfull and I get an idea in other post. At the end I added a reference to the component:

And on the method "CambiarLinea" I reset the componente before that I get the iformation.

On this way it´s working properlly, so I´m very happy with it.

Have a very good day.

bye.