AutoPostBack Kendo ComboBox MVC 5

2 posts, 0 answers
  1. Santiago
    Santiago avatar
    2 posts
    Member since:
    Apr 2015

    Posted 27 Apr 2015 Link to this post

    Hi Telerik Team,

    We are facing an issue with the Kendo ComboBox Control on MVC5. 

    Is there any way to avoid/deactivate the AutoPostBack of the ComboBox when the user press the enter key? We've tried to bind by jQuery other functions on keypress and keydown events without luck.

     

    Here is the code:

    @(Html.Kendo().ComboBox()
             .Name("cmbUsuarios")
             .DataTextField("NombreUsuario")
             .DataValueField("Id")
             .Placeholder("Seleccione Usuarios...")
             .Filter(FilterType.StartsWith)
             .AutoBind(false)
             .HtmlAttributes(new { @class = "form-control", @style = "width: 100%" })
             .MinLength(2)
             .DataSource(source =>
             {
                 source.Read(read =>
                 {
                     read.Action("GetUsers", "Perfil")
                         .Data("filterUsers").Type(HttpVerbs.Get);
                 })
                 .ServerFiltering(true);
             }))

    <script>
    function filterUsers() {
            return {
                userFilter: $("#cmbUsuarios").data("kendoComboBox").text()
            };
        }
    </script>

     

    Version of Kendo.Mvc: 2015.1.318.545

    Thanks!

  2. Georgi Krustev
    Admin
    Georgi Krustev avatar
    3707 posts

    Posted 29 Apr 2015 Link to this post

    Hello Santiago,

    If my understanding is correct, you would like to prevent form post when user presses ENTER key. If this is the case, then I would suggest you check this how-to demo.

    Regards,
    Georgi Krustev
    Telerik
     

    See What's Next in App Development. Register for TelerikNEXT.

     
  3. UI for ASP.NET MVC is VS 2017 Ready
Back to Top