Set initial Data and bind remotely only after Min Length exceeded

2 posts, 0 answers
  1. Kevin
    Kevin avatar
    22 posts
    Member since:
    Feb 2014

    Posted 12 Jun 2014 Link to this post

    Hi,

    We have a page with several combobox's and due to the delay from them all AutoBinding the page loads with the numeric value displaying inside the textbox and is only replaced by the text after the bind.  Is there a way to set an initial data binding while still attaching the read method to load server filtered alternatives via Ajax?  This way the page will display the text on load, and avoid multiple simultaneous ajax requests.

    For example here is some failed code I've tried to give you some idea of what I would like.

    @(Html.Kendo().ComboBoxFor(x => x.List[i].ID)
                                .DataTextField("Name")
                                .DataValueField("ID")
                                .Filter(FilterType.StartsWith)
                                .MinLength(3)
                                .BindTo(new List<ItemDTO>(){
                                    new ItemDTO(){
                                        ID = Model.List[i].ID,
                                        Name = Model.List[i].Name
                                    }
                                })
                                .AutoBind(false)
                                .DataSource(ds =>
                                {
                                    ds.Read(r => r.Action("Action", "Controller").Data("filter")).ServerFiltering(true);
                                })
                                .Events(e => e.Change("Change"))
                        )

    Thanks,
    Kevin
  2. Daniel
    Admin
    Daniel avatar
    2117 posts

    Posted 16 Jun 2014 Link to this post

    Hello Kevin,

    You should the text option to set the initial text when the automatic binding is disabled in order to avoid showing the value.

    Regards,
    Daniel
    Telerik
     

    Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.

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