This is a migrated thread and some comments may be shown as answers.

Filter with itemdatabound not working

4 Answers 159 Views
ComboBox
This is a migrated thread and some comments may be shown as answers.
roberto
Top achievements
Rank 1
roberto asked on 24 Feb 2011, 07:27 PM
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.

4 Answers, 1 is accepted

Sort by
0
Princy
Top achievements
Rank 2
answered on 25 Feb 2011, 12:47 PM
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.
0
roberto
Top achievements
Rank 1
answered on 25 Feb 2011, 05:18 PM
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
0
Helen
Telerik team
answered on 01 Mar 2011, 05:18 PM
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!
0
Simon
Telerik team
answered on 15 Mar 2011, 09:21 PM
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!
Tags
ComboBox
Asked by
roberto
Top achievements
Rank 1
Answers by
Princy
Top achievements
Rank 2
roberto
Top achievements
Rank 1
Helen
Telerik team
Simon
Telerik team
Share this question
or