This is a migrated thread and some comments may be shown as answers.

current value not remembered

1 Answer 88 Views
DropDownList
This is a migrated thread and some comments may be shown as answers.
sjarl
Top achievements
Rank 1
sjarl asked on 09 Mar 2018, 11:06 AM

Hi,

because my dropdown has over 1.000 possible values I've implemented ServersSide filtering

according to this example.

https://demos.telerik.com/aspnet-mvc/dropdownlist/serverfiltering

the only issue is that with a 1000 records servers side filtering still is slow when expanding the dropdownlist. because it the text is empty, all data is retrieved.

To avoid this issue I only select top 100 ".Take(100)" and the performance is way better.

the only issue is, when I open the dropdown for the 2nd time the selected item gets reset to the default one, if the selected item is not in the first 100 records.
In my oppinion, the current selected item should stay.

so My question, is there a way to make the current value stay,
or can I send the current selected value as a parameter?
for the edit Form, I already use the current value, so at least that one is always in the selection

read.Action("FilteredDDL", "some Controller", new { selectedValue = @Model.selectedvalue });

but this only helps if the value is already in the model.

 

Does someone know a good solution?

1 Answer, 1 is accepted

Sort by
0
sjarl
Top achievements
Rank 1
answered on 09 Mar 2018, 11:36 AM

ok,
a little more googling gives me this
https://www.telerik.com/forums/include-current-item-in-server-side-filter

which works.

Tags
DropDownList
Asked by
sjarl
Top achievements
Rank 1
Answers by
sjarl
Top achievements
Rank 1
Share this question
or