Behavior stange in combobox

2 posts, 0 answers
  1. Xavier
    Xavier avatar
    28 posts
    Member since:
    Dec 2010

    Posted 06 Mar 2015 Link to this post

    I show you the scenario, we have a combobox with filter “contains”. 

    Combobox ProductorSearch
    @model int
        .HtmlAttributes(new { style = "width:300px" })
        .DataSource(source =>
            source.Read(read => read.Action("SearchProductors", "Productors", new { area = "Comercial" }).Data("filterProductors"))
    <script id="ProductorSearch_HeaderTemplate" type="text/x-kendo-tmpl">
            <span class="k-widget k-header">Productor</span>
            <span class="k-widget k-header">Poblacio</span>
    <script id="ProductorSearch_ItemTemplate" type="text/x-kendo-tmpl">
        <div style="width:300px">
            @*<span class="k-state-default">#: data.Poblacio #</span>*@
            <p><span class="k-state-default">#: data.Nom #</span><span class="k-state-default">#: data.Poblacio #</span></p>

    public class CollectServiceViewModel
            [HiddenInput(DisplayValue = false)]
            [Required(ErrorMessage = "El número d'ordre es obligatori.")]
            public int ServiceID { get; set; }
            public string RefExt { get; set; }
            [DisplayName("Full Seguiment")]
            public string DocNum { get; set; }
            [DisplayName("Data Comanda")]
            //[DisplayFormat(DataFormatString = "{0:d}")]
            public DateTime DataOrdre { get; set; }
            [DisplayName("Data Servei")]
            public Nullable<DateTime> DataServei { get; set; }
            public Nullable<int> ExpeditionID { get; set; }
            //public Nullable<short> Position { get; set; }
            public bool Urgent { get; set; }
            public Nullable<DateTime> DataClaim { get; set; }
            [DisplayName("Recollida Extra")]
            public bool Extra { get; set; }
            [Required(ErrorMessage = "El productor es obligatori.")]
            public int ContactID { get; set; }
            [HiddenInput(DisplayValue = false)]
            public string ProductorName { get; set; }

    Grid in View
            .HtmlAttributes(new { style = "height: 100%; border: 0;" })
            .ToolBar(t =>
                if (User.IsInRole("Modify"))
                    t.Create().Text("Nou Servei");
            .Columns(columns =>
                columns.Bound(f => f.ServiceID).Width(80);
                columns.Bound(f => f.DataServei).Width(110);
                columns.Bound(f => f.RefExt).Width(110);
                columns.Bound(f => f.DocNum).Width(110);
                columns.Bound(f => f.ProductorName).Width(300).Filterable(f => f.Operators(g => g.ForString(h => { h.Clear(); h.Contains("Conté"); })));
                columns.Bound(f => f.ContactID).Title("Codi").Width(80);

    The first time I write a text with 4 o more chars my chars are hidden and then I can see a char 0. This behavior is only occurred the first time, after that the behavior is normal.

    Thanks in advance.
  2. Kiril Nikolov
    Kiril Nikolov avatar
    2596 posts

    Posted 10 Mar 2015 Link to this post

    Hello Xavier,

    The problem is caused by the fact that the combobox has autoBind set to false, and a value is set when the Grid goes into edit mode, and while there is value, but there is nothing in the dataSource you see the value in the widget. I would suggest you to turn on the autoBinding in order to resolve this issue.

    Kiril Nikolov

    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.

Back to Top