Dropdownlist Virtualization Guid

2 Answers 94 Views
ComboBox DropDownList
Chris
Top achievements
Rank 1
Chris asked on 11 May 2022, 04:13 AM
How can i use the dropdownlist Virtualization with a guid id?

2 Answers, 1 is accepted

Sort by
0
Eyup
Telerik team
answered on 13 May 2022, 09:40 AM

Hi Chris,

 

Thank you for writing to us.

The key to the Virtualization implementation is the ValueMapper function, both on client and server-side:
https://demos.telerik.com/aspnet-mvc/dropdownlist/virtualization

Frankly put, we haven't tested this scenario using GUID values, but you can try to change the logic to use GUID instead of integers and theoretically it should work the same way:

public ActionResult Orders_ValueMapper(int[] values)

 

Regards,
Eyup
Progress Telerik

Virtual Classroom, the free self-paced technical training that gets you up to speed with Telerik and Kendo UI products quickly just got a fresh new look + new and improved content including a brand new Blazor course! Check it out at https://learn.telerik.com/.

0
Mahdi
Top achievements
Rank 1
Iron
answered on 27 Jun 2022, 09:59 AM

Hi Chris,

Actually, I implemented the same with Guid, it's a piece of cake, you should only change the ValueMapper on your controller as follows:


public ActionResult ValueMapper(List<Guid?> values)
        {
            var indices = new List<int>();

            if (values != null && values.Any())
            {
                var index = 0;
                var list = GetJobs();
                foreach (var item in list)
                {
                    if (values.Contains(item.ID))
                    {
                        indices.Add(index);
                    }

                    index++;
                }
            }

            return Json(indices, JsonRequestBehavior.AllowGet);
        }

 

Best Regards,

Mahdi

Eyup
Telerik team
commented on 30 Jun 2022, 07:38 AM

Hi Mahdi,

Thanks a lot for sharing your solution with our community!

Tags
ComboBox DropDownList
Asked by
Chris
Top achievements
Rank 1
Answers by
Eyup
Telerik team
Mahdi
Top achievements
Rank 1
Iron
Share this question
or