Filter with itemdatabound not working

5 posts, 0 answers
  1. roberto
    roberto avatar
    5 posts
    Member since:
    Feb 2011

    Posted 24 Feb 2011 Link to this post

    Hi!
    I have a combobox with a datasource and on itemdatabound I set the item.text and the item.value, but when trying to filter it doesn't work. The filter works fine when I just type one letter, but after I type another one it tells me that no matches were found. The filter is in "Contains" mode.

    Thanks in advance.
  2. Princy
    Princy avatar
    17421 posts
    Member since:
    Mar 2007

    Posted 25 Feb 2011 Link to this post

    Hello,


    From one of the forum I found that the issue resolved in latest build. Could you try downloading latest version of RadControls and check whether the issue resolved?
    http://www.telerik.com/support/kb/aspnet-ajax/general/updating-radcontrols-for-asp-net-to-another-version-or-license.aspx


    Thanks,
    Princy.
  3. roberto
    roberto avatar
    5 posts
    Member since:
    Feb 2011

    Posted 25 Feb 2011 Link to this post

    Hi
    Thanks for your answer, but I'm pretty sure that I have the most recent build. The build I got is 2010.3.1317.40.

    I noticed that the problem only is present when I set EnableAutomaticLoadOnDemand to true, if I use EnableLoadOnDemand the filter works fine. Maybe is something that I'm missing, but I don't know what it is. 

    Here is the code:
    <telerik:RadComboBox ID="cmbOrigen" runat="server" Width="250px" AllowCustomText="True" AutoPostBack="true" 
      DataSourceID="dsFake" DataValueField="Id" OnItemDataBound="CmbOrigen_ItemDataBound"
            EmptyMessage="Origen" DropDownWidth="260px" OnSelectedIndexChanged="CmbOrigenDestino_SelectIndexChanged"
      EnableAutomaticLoadOnDemand="true" Filter="Contains" HighlightTemplatedItems="True" ItemsPerRequest="10" 
            LoadingMessage="Cargando..." Localization-ShowMoreFormatString="Más" MarkFirstMatch="True" MaxHeight="300px" ShowDropDownOnTextboxClick="False"                
                    ShowMoreResultsBox="True" Sort="Ascending" SortCaseSensitive="False"
    </telerik:RadComboBox>

    protected void CmbOrigen_ItemDataBound(object sender, RadComboBoxItemEventArgs e)
    {
            string ciudad = ((DataRowView)e.Item.DataItem)["Nombre"].ToString(); 
            string pais = ((DataRowView)e.Item.DataItem)["Pais"].ToString(); 
      
            e.Item.Text = string.Format("{0}, {1}", ciudad, pais);
    }

    Thanks in advance
  4. Helen
    Admin
    Helen avatar
    1052 posts

    Posted 01 Mar 2011 Link to this post

    Hi Roberto,

    Thank you for the report. I forwarded your request to our development team for further investigation and they will notify you once they have a certain result.

    Regards,
    Helen
    the Telerik team
    Registration for Q1 2011 What’s New Webinar Week is now open. Mark your calendar for the week starting March 21st and book your seat for a walk through all the exciting stuff we ship with the new release!
  5. Simon
    Admin
    Simon avatar
    2281 posts

    Posted 15 Mar 2011 Link to this post

    Hi roberto,

    The filter during automatic load on demand filters the underlying data either by the field set in the DataTextField property or by the string representation of the underlying data object. Additionally this happens before the data is passed to the RadComboBox itself and before it throws its ItemDataBound event.

    In your markup I cannot see the DTF property and this is most likely the reason for the unexpected behavior. 

    So if you need to filter through just one column of the underlying data source you can set the DTF property to make it work. Otherwise you can achieve the same result by modifying the Select query of the data source to return the two columns as one named column and set the DTF property to that name. Then you will also can remove the IDB event handler as it will be unnecessary.

    Please let me know whether this solution is applicable to your case.

    Kind regards,
    Simon
    the Telerik team
    Registration for Q1 2011 What’s New Webinar Week is now open. Mark your calendar for the week starting March 21st and book your seat for a walk through all the exciting stuff we ship with the new release!
Back to Top