When events are added Kendo Autocomplete is not working

4 posts, 0 answers
  1. Adrian Barnes
    Adrian Barnes avatar
    19 posts
    Member since:
    Dec 2009

    Posted 12 May 2017 Link to this post

    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>
  2. Ivan Danchev
    Admin
    Ivan Danchev avatar
    1347 posts

    Posted 15 May 2017 Link to this post

    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.
  3. Matthew
    Matthew avatar
    8 posts
    Member since:
    Oct 2017

    Posted 09 Nov 2017 in reply to Ivan Danchev Link to this post

    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. 
  4. Ivan Danchev
    Admin
    Ivan Danchev avatar
    1347 posts

    Posted 13 Nov 2017 Link to this post

    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.
Back to Top