How to preselect a value in DropdownDataGrid

I have a DropdownDataGrid, and I can manage to show a preselected value when the page is loaded and the dropdown is still closed, it displays the current value as I pass in the field:


what should be the selected one.
Until here all good, the issue is, when you open the dropdown, the "preselected" value is not highlighted!!
How can I make it highlighted?
But if I click on a new value in the dropdown, close it and open it again, the new value will be highlighted!
I encounter this issue only at the first load of the page, where it selects the right value (I see it from the closed dropdown that the good value is showed), but when you open it, it doesnt hightlight it in the list of values!

Thank you

I think I tried everything, and really cannot manage to have a preselected value (highlighted in the dropdown grid) when opening the DropDownDataGrid the first time, please could someone help me out?

I recommend checking the pages that Radzen generates when using a DropDownDatagrid. Check how the SelectedValue property is set.

sorry I didn't understand what do you mean by "the pages that Radzen generates when using a DropDownDataGrid"

what pages does it generate? sorry but I Cannot understand

I mean the option "Allow paging, sorting and filtering of lookup data" in the CRUD pages wizard. It uses DropDownDataGrid and preconfigures everything required.

@korchev Thank you very much for the answer, appreciete it!

Sadly I didn't find that option, when I create a new page I'm missing some stuff that you have in the screenshot, I guess it's because of my Radzen version?

So I prepared a picture, here I'm doing a test, I create 2 properties, one will be my DataSource, a dummy array of objects, and one will be my "selected value" which should be the preselected value of the DropdownDataGrid on Load.

as you can see, the correct value ("value 3") is preselected on the actual dropdown, which is correct, but if I open the dropdown, you see that the "value 3" row is not highlighted! This happens only on Load, if I manually select a value, close the dropdown and open it again, now the selected value will be highlighted!

I tried setting up the properties of the DropdownDataGrid in many different ways, I Filled both "Value" and "SelectedValue" properties in different ways but nothing that worked!

Ok I just found the solution...basically there is a property to set the Highlighted value..but it is not available in Radzen Properties of the dropdowndataGrid, but must be set manually in the load() of the page:

this.dropdownDatagrid0.selection = ${selected};

this line of code makes now the value highlighted on load!

1 Like