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

When events are added Kendo Autocomplete is not working

3 Answers 215 Views
AutoComplete
This is a migrated thread and some comments may be shown as answers.
Adrian Barnes
Top achievements
Rank 1
Adrian Barnes asked on 12 May 2017, 11:59 AM

Below is my autocomplete code. If I uncomment the Events section above the span class 'k-widget k-autocomplete k-header k-state-default' is removed, and the Kendo autocomplete is stoped and it is like a simple text box. Autocomplete functionality will be no more and no events are fired. Please let me know how should I fix the issue, and what may be reason for the same.

<style>

        .imgslt .k-autocomplete {
            width: 25% !important;
        }
    </style>

  

<div class="form-group imgslt">
            <label>Select Image:</label>
            <div class="demo-section k-content">
                @(Html.Kendo().AutoComplete()
          .Name("ImageNameList")
          .DataTextField("imageName")
          .Filter("contains")
          .MinLength(2)
          .HtmlAttributes(new { style = "width:100%" })
          //.Events(e => e
          //      .Select("autocomplete_select")
          //      .Change("autocomplete_change")
          //  )
          .DataSource(source =>
          {
              source.Read(read =>
              {
                  read.Action("GetListImages", "Assessment");
                  //.Data("onAdditionalData");
              })
              .ServerFiltering(false);
          })
 
                )
            </div>
 
<script>
 
     function autocomplete_select() {
                //Handle the select event.
      alert('select');
            }
 
            function autocomplete_change() {
                //Handle the change event.
    alert('change');
            }
 
</script>

3 Answers, 1 is accepted

Sort by
0
Ivan Danchev
Telerik team
answered on 15 May 2017, 01:32 PM
Hello Adrian,

The described behavior could be a sign for a js exception on your page. I tested your AutoComplete configuration and at my side it is working as expected. I attached a sample runnable project that you could give a try. Both AutoComplete events fire and the widget is styled correctly.

Regards,
Ivan Danchev
Telerik by Progress
Try our brand new, jQuery-free Angular 2 components built from ground-up which deliver the business app essential building blocks - a grid component, data visualization (charts) and form elements.
0
Matthew
Top achievements
Rank 1
answered on 09 Nov 2017, 03:11 PM
I'm having this issue as well. I've downloaded your code, it works. But when I try and copy your code into my project, it doesn't work. Could we possibly be missing a library? When I add .Events to my autocomplete, the autocomplete turns into a basic textbox. So it stops showing a list of items, and stops doing any autocomplete. 
0
Ivan Danchev
Telerik team
answered on 13 Nov 2017, 11:09 AM
Hello Matthew,

If you want to use Telerik UI for ASP.NET MVC wrappers (such as the AutoComplete MVC wrapper) in your project you can follow the steps described in this documentation article. It explains which CSS and js files are required and need to be registered, as well as how to reference the Kendo.Mvc.dll assembly and how to configure the Web.config file and add the corresponding namespace. Let us know in case you encounter difficulties at any of the listed steps.

Regards,
Ivan Danchev
Progress Telerik
Try our brand new, jQuery-free Angular components built from ground-up which deliver the business app essential building blocks - a grid component, data visualization (charts) and form elements.
Tags
AutoComplete
Asked by
Adrian Barnes
Top achievements
Rank 1
Answers by
Ivan Danchev
Telerik team
Matthew
Top achievements
Rank 1
Share this question
or