This is a migrated thread and some comments may be shown as answers.

Add a Button in nodatatemplate of Autocomplete in MVC

1 Answer 201 Views
AutoComplete
This is a migrated thread and some comments may be shown as answers.
Ajith
Top achievements
Rank 1
Ajith asked on 30 Jan 2020, 08:12 AM
How to add a button in nodatatemplate of autocomplete widget in MVC. Sample screenshot is attached.

1 Answer, 1 is accepted

Sort by
0
Martin
Telerik team
answered on 03 Feb 2020, 07:36 AM

Hello Ajith,

You can add a button in the noDataTemplate using the NoDataTemplateId:

.NoDataTemplateId("noDataTemplate")

Template:

<script id="noDataTemplate" type="text/x-kendo-tmpl">
    <div>
        No data found. Do you want to add new item - '#: instance.element.val() #' ?
    </div>
    <br />
    <button class="k-button" onclick="addNew('#: instance.element[0].id #', '#: instance.element.val() #')">Add new item</button>
</script>

Attached you will find a small project to demonstrate the above.

Let me know if you have any questions.

Regards,
Martin
Progress Telerik

Get quickly onboarded and successful with your Telerik and/or Kendo UI products with the Virtual Classroom free technical training, available to all active customers. Learn More.
Tags
AutoComplete
Asked by
Ajith
Top achievements
Rank 1
Answers by
Martin
Telerik team
Share this question
or