# Templates

The DropDownList provides full control over the rendering of items, selected values, and popup headers by using [Kendo UI templates](https://www.telerik.com/kendo-jquery-ui/documentation/framework/templates/overview).

For a complete example, refer to the [demo on customizing the DropDownList templates](https://demos.telerik.com/kendo-ui/dropdownlist/template).

The DropDownList supports the following templates:

* [Item templates](https://www.telerik.com/kendo-jquery-ui/documentation/controls/dropdownlist/templates#item-templates)
* [Value templates](https://www.telerik.com/kendo-jquery-ui/documentation/controls/dropdownlist/templates#value-templates)
* [Header templates](https://www.telerik.com/kendo-jquery-ui/documentation/controls/dropdownlist/templates#header-templates)
* [Footer templates](https://www.telerik.com/kendo-jquery-ui/documentation/controls/dropdownlist/templates#footer-templates)
* [No-data templates](https://www.telerik.com/kendo-jquery-ui/documentation/controls/dropdownlist/templates#no-data-templates)

## Item Templates

The item template manages the way the list items of a DropDownList are rendered.

```dojo
    <input id="dropdownlist" />
    
    <script id="scriptTemplate" type="text/x-kendo-template">
        ContactName: #:data.ContactName#, CustomerID: #:data.CustomerID#
    </script>

    
    <script>
        $(document).ready(function() {
            $("#dropdownlist").kendoDropDownList({
                template: $("#scriptTemplate").html(),
                dataTextField: "ContactName",
                dataValueField: "CustomerID",
                dataSource: {
                    transport: {
                        read: {
                            url: "https://demos.telerik.com/service/v2/core/Customers"
                        }
                    }
                }
            });
        });
    </script>
```

## Value Templates

The value template manages the way the selected value of a DropDownList is rendered.

> Value templates must consist of inline HTML elements only.

```dojo
    <input id="dropdownlist" />
    
    <script id="valueTemplate" type="text/x-kendo-template">
        ContactName: #:data.ContactName#
    </script>

    
    <script>
        $(document).ready(function() {
            $("#dropdownlist").kendoDropDownList({
                valueTemplate: $("#valueTemplate").html(),
                dataTextField: "ContactName",
                dataValueField: "CustomerID",
                dataSource: {
                    transport: {
                        read: {
                            url: "https://demos.telerik.com/service/v2/core/Customers"
                        }
                    }
                }
            });
        });
    </script>
```

## Header Templates

The header template manages the way the popup header of a DropDownList is rendered.

```dojo
    <input id="dropdownlist" />
    
    <script id="headerTemplate" type="text/x-kendo-template">
        <strong>Header</strong>
    </script>

    
    <script>
        $(document).ready(function() {
            $("#dropdownlist").kendoDropDownList({
                headerTemplate: $("#headerTemplate").html(),
                dataTextField: "ContactName",
                dataValueField: "CustomerID",
                dataSource: {
                    transport: {
                        read: {
                            url: "https://demos.telerik.com/service/v2/core/Customers"
                        }
                    }
                }
            });
        });
    </script>
```

## Footer Templates

The footer template manages the way the popup footer of a DropDownList is rendered. The footer is re-rendered on every change of the Data Source. The context of the template is the widget itself.

```dojo
    <input id="dropdownlist" />
    
    <script id="footerTemplate" type="text/x-kendo-template">
        Total <strong>#: instance.dataSource.total() #</strong> items found
    </script>

    
    <script>
        $(document).ready(function() {
            $("#dropdownlist").kendoDropDownList({
                footerTemplate: $("#footerTemplate").html(),
                dataTextField: "ContactName",
                dataValueField: "CustomerID",
                dataSource: {
                    transport: {
                        read: {
                            url: "https://demos.telerik.com/service/v2/core/Customers"
                        }
                    }
                }
            });
        });
    </script>
```

## No-Data Templates

The DropDownList widget displays `noDataTemplate` in the popup when the data source is empty.

> When the `noDataTemplate` option is defined, the DropDownList always opens the popup element.

```dojo
    <input id="dropDownList" />
    
    <script id="noDataTemplate" type="text/x-kendo-template">
        <strong>No Data!</strong>
    </script>

    
    <script>
        $(document).ready(function() {
            $("#dropDownList").kendoDropDownList({
                noDataTemplate: $("#noDataTemplate").html(),
                dataTextField: "ContactName",
                dataValueField: "CustomerID",
                dataSource: {
                    transport: {
                        read: {
                            url: "https://demos.telerik.com/service/v2/core/Customers"
                        }
                    }
                }
            });
        });
    </script>
```

## See Also

* [Customizing the Templates in the DropDownList (Demo)](https://demos.telerik.com/kendo-ui/dropdownlist/template)
* [JavaScript API Reference of the DropDownList](https://www.telerik.com/kendo-jquery-ui/documentation/api/ui/dropdownlist)
