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

[Solved] Combo automatically selects first match no matter what is highlighted

2 Answers 67 Views
ComboBox
This is a migrated thread and some comments may be shown as answers.
Cris
Top achievements
Rank 1
Cris asked on 02 Jun 2009, 10:39 AM

Hi,

I have this Combo

 

                                        <telerik:RadComboBox ID="rcbContact" Runat="server" AllowCustomText="True"   
                                            EmptyMessage="Nume persoana" EnableLoadOnDemand="True"   
                                            HighlightTemplatedItems="True"   
                                            ShowToggleImage="False" onitemsrequested="rcbContact_ItemsRequested" LoadingMessage="Incarca..."   
                                            ShowDropDownOnTextboxClick="False" DropDownWidth="450px">  
                                            <HeaderTemplate> 
                                            <table><tr><td style="width:200px">Nume</td><td style="width:250px">Companie</td></tr></table> 
                                            </HeaderTemplate> 
                                            <ItemTemplate> 
                                            <table><tr><td style="width:200px"><%# DataBinder.Eval(Container.DataItem, "V") %></td><td style="width:250px"><%# DataBinder.Eval(Container.DataItem, "CompanyName") %></td></tr></table>  
                                            </ItemTemplate> 
                                        </telerik:RadComboBox> 

which seems to have a problem. It's made into an autocomplete box (the number of choices given lower as you type). Notice the items are templated.
The problem is that while that works (as you type the number of displayed persons is getting lower), as soon as the combo loses focus the first match is selected no matter what I had tried to select from the dropdown.

I have another identical combo which has no templates. That one works just fine. Could you please let me know what I'm doing wrong? Mind you I checked - ItemsRequested is not called again so the combo is not being rebinded.

Thanks,
Cris

 

2 Answers, 1 is accepted

Sort by
0
Accepted
Yana
Telerik team
answered on 04 Jun 2009, 01:12 PM
Hi Cris,

Please check whether Text or Value properties of the items are set.  You can set them like this:

rcbContact.DataTextField = "CompanyName";  
rcbContact.DataValueField = "V"

All the best,
Yana
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Check out the tips for optimizing your support resource searches.
0
Cris
Top achievements
Rank 1
answered on 04 Jun 2009, 02:09 PM
Hey, thanks - that was it indeed. I set them and now it works.
Tags
ComboBox
Asked by
Cris
Top achievements
Rank 1
Answers by
Yana
Telerik team
Cris
Top achievements
Rank 1
Share this question
or