How do you generate a unique name for a control that is part of a template? I have a DropDownList in my template for a TaskBoard but only the first instance works since the name of each is the same I assume. The browser warns me too that that is the case. Appreciate any help.
-Scott
1 Answer, 1 is accepted
0
Tsvetomir
Telerik team
answered on 25 Jun 2021, 10:14 AM
Hi, Scott,
In general, when the templates of the taskboard are built, the data item associated with the respective template is passed. Hence, you have access to the field values of the data item. The recommended approach is to decorate the names of the inner widgets in such a way that they feature the ID of the data item. This way, you know 100% that the names are unique as for the different templates you will have different IDs.
You could access the field as shown below. You could concatenate it with the name of the DropDownList so that it procudes a unique name:
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/.