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

Combobox Filter

2 Answers 151 Views
ComboBox
This is a migrated thread and some comments may be shown as answers.
Senthil ramna
Top achievements
Rank 1
Senthil ramna asked on 18 Aug 2010, 05:37 AM
I am trying to use filter property for which i got a suggestion to use this thread
http://www.telerik.com/help/aspnet-ajax/combo-select-existing-item.html suggested by Yana from Telerik Team.
My requirement was i wanted to restrict user from entering text which is not in a display member of combobox items.
<telerik:RadComboBox ID="radProject" AllowCustomText="false" AccessibilityMode="false" AutoPostBack="true" 
                         runat="server" DropDownWidth="240px" onselectedindexchanged="radProject_SelectedIndexChanged" 
                         EnableLoadOnDemand="false" MarkFirstMatch="true" ondatabinding="radProject_DataBinding" Skin="Web20" 
                         Filter="Contains" OnClientBlur="OnClientBlurHandler"
                </telerik:RadComboBox>

so lets say i have two items in my combobox list lets say India and Spain when i type in S, Spain is fitered and it is highlighted and onSelectedindexchanged kicks in. But lets say i type in Mexico or something and it is not in the list and onSelectedindexchanged i am getting this exception stating Object reference not set to an instance of an object.
If i st EnableLoadOnDemand = true then this exception is not encountered but the combobox just takes the first item as the selected item and onSelectedindexchanged kicks in and it is redirected to the next page, but i don't want this, i want to restrict the user from entering text that is not a display member of combobox items.
I am in need of any asistance from any of you guys out there, tell me if i am doing some mistake or how can i go about solving the current predicament that i am in.
Thanks in advance.

2 Answers, 1 is accepted

Sort by
0
Accepted
Princy
Top achievements
Rank 2
answered on 19 Aug 2010, 06:56 AM
Hello Senthil,

One suggestion is to remove the Filter property of RadComboBox and check whether this helps to achieve your requirement.

Thanks,
Princy.
0
Senthil ramna
Top achievements
Rank 1
answered on 20 Aug 2010, 05:06 AM
Thanks a lot princy that did the trick.
Tags
ComboBox
Asked by
Senthil ramna
Top achievements
Rank 1
Answers by
Princy
Top achievements
Rank 2
Senthil ramna
Top achievements
Rank 1
Share this question
or