Dropdown list template array?

I want to an item template for a list of string


<SfDropDownList Placeholder="Circuit Notes" TValue="string" TItem="string" DataSource="@notes" TValue="string">
<DropDownListEvents ValueChange="@OnChange" TValue="string" TItem="string"></DropDownListEvents>
</SfDropDownList>


private List<string> notes { get; set; } = new List<string> {"test", "test1", "test2"}

2 Replies 1 reply marked as answer

SP Sureshkumar P Syncfusion Team June 28, 2022 12:53 PM UTC



SP Sureshkumar P Syncfusion Team June 30, 2022 07:08 AM UTC

Hi Pavel,

You can achieve your requirement by using the below code example.

Find the code example here:

<SfDropDownList Placeholder="Circuit Notes" TValue="string" TItem="string" DataSource="@notes" TValue="string">

    <DropDownListTemplates TItem="string">

        <ItemTemplate>

            <span><span class='name'>@context</span></span>

        </ItemTemplate>

    </DropDownListTemplates>

</SfDropDownList>

 

@code {

    private List<string> notes { get; set; } = new List<string> { "test", "test1", "test2" };

}


Find the screenshot here:

Regards,

Sureshkumar P


Marked as answer
Loader.
Up arrow icon