All rows show same data in Dropdown

Dropdowns show same data for each row for selected value. When a selection is made randomly the value get updated correctly for index selected to selected value and expanding dropdown again shows selected values. They were implement in two different ways.

  1. In a grid, under Columns property (column with dropdown filter), FilterTemplate was set
 <RadzenDropDown  Style="width:100%" Change=OnChange bind-Value="Globals.sInstanceForSystemTabs" Data="((List<Wmdsui.Models.SystemTypes.SystemInstance>)Globals.resultInstanceList)" TItem="Wmdsui.Models.SystemTypes.SystemInstance" >
                  <Template Context="SystemInstance">
                        <div>Globals.sInstanceForSystemTabs.SystemInstanceName</div>
                        </Template>
                        </RadzenDropDown>
                  </FilterTemplate>
                </RadzenGridColumn>
  1. Using Drag and Drop component from Tool

TemplateProperty was set to Globals.sInstance.SystemInstanceName

and code produced was this

  <RadzenDropDown AllowFiltering="true" Data="(Globals.sInstanceList)" style="height: 27px; margin-left: 20px; margin-top: 40px" Name="Dropdown1"  LoadData="Dropdown1LoadData" TValue="Wmdsui.Models.SystemTypes.SystemInstance" bind-Value="(Globals.sInstance)">
      <Template Context="data">
      Globals.sInstance.SystemInstanceName
      </Template>
    </RadzenDropDown>

DropdownBug

Hi @KaurParminder,

We don't understand what the problem is and only see an excerpt from your code. Please format any code in your post so we see the whole picture. Alternatively you can send us a sample running project to info@radzen.com.

@korchev Thank you Atanas, I have edited the topic. look forward to any support you can provide.

Your template is using the same expression for every item. You probably need to use the data variable provided as the template context. Something like:

<Template Context="data">
    @data.SystemInstanceName
</Template>

The template context represents an item from the list which the Data property is set to. The DropDown renders an option for every item from that list and provides it as the template context. Check the template demo from our example: https://blazor.radzen.com/dropdown

@korchev Thanks Atanas, that worked :smiley: