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

Combobox

6 Answers 101 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 17 Aug 2010, 01:18 PM
wanted to ask if i do set EnableLoadOnDemad, MarkFirstMatch and AllowCustomText to true, how to restrict user from entering text which is not in a display member of combobox items.
Like lets say i have India, USA and Russia as my combobox items then if i type in Spain in the combobox how to give a message to the user that this item is not present in the combobox list of items.
i would like to do this validation in the OnSlectedindexchanged event please let me know if this can be done.
this is how my combobox looks:
<telerik:RadComboBox ID="radProject" AllowCustomText="true"    AccessibilityMode="false" AutoPostBack="true" runat="server" DropDownWidth="240px" onselectedindexchanged="radProject_SelectedIndexChanged" EnableLoadOnDemand="true" MarkFirstMatch="true" Skin="Web20" Filter="Contains"
ondatabinding="radProject_DataBinding">
</telerik:RadComboBox>


any input is appreciated.

6 Answers, 1 is accepted

Sort by
0
Yana
Telerik team
answered on 17 Aug 2010, 01:25 PM
Hello Senthil,

Please check this help article regarding this requirement.

Best regards,
Yana
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
0
Senthil ramna
Top achievements
Rank 1
answered on 17 Aug 2010, 01:51 PM
Thanks for the response Yana .
i did check the article but i am not able to understand like what should i do in my case.
please can you tell me where i should call the javascript is it in OnClientBlur but how to make sure that the user will be able to type only letters that match text of the items.
please if you could elobarate a little as in my case i want it to validate or check if the item is there or not in OnSelectedIndex changed event when the user types letters which are not present in the combobox items.
avaiting your response.
0
Cori
Top achievements
Rank 2
answered on 17 Aug 2010, 02:10 PM
Yes, you are supposed to handle the OnClientBlur client-side event.
0
Senthil ramna
Top achievements
Rank 1
answered on 17 Aug 2010, 02:18 PM
I did that but lets say my combobox list contains items like apple, orange.
when i select apple selectedindexchanged event kicks in and page gets redirected as it should.
but lets say i type in something else and selectedindexchanged kicks in and i get an exception saying Object reference not set to an instance of an object.
so how to proceed.
0
Cori
Top achievements
Rank 2
answered on 17 Aug 2010, 02:30 PM
Is that what happens when you type in an item that doesn't exist when handling the OnClientBlur event? Also, did you set AllowCustomText to false?
0
Senthil ramna
Top achievements
Rank 1
answered on 17 Aug 2010, 02:37 PM
yeah that is what is happening cori.
this is how my control looks
<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>

if i am missing something please let me know
thanks again cori.
Tags
ComboBox
Asked by
Senthil ramna
Top achievements
Rank 1
Answers by
Yana
Telerik team
Senthil ramna
Top achievements
Rank 1
Cori
Top achievements
Rank 2
Share this question
or