1. Senthil ramna
    Senthil ramna avatar
    67 posts
    Member since:
    Mar 2010

    Posted 17 Aug 2010 Link to this post

    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.
  2. Yana
    Admin
    Yana avatar
    4897 posts

    Posted 17 Aug 2010 Link to this post

    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
  3. Senthil ramna
    Senthil ramna avatar
    67 posts
    Member since:
    Mar 2010

    Posted 17 Aug 2010 Link to this post

    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.
  4. Cori
    Cori avatar
    562 posts
    Member since:
    Jul 2010

    Posted 17 Aug 2010 Link to this post

    Yes, you are supposed to handle the OnClientBlur client-side event.
  5. Senthil ramna
    Senthil ramna avatar
    67 posts
    Member since:
    Mar 2010

    Posted 17 Aug 2010 Link to this post

    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.
  6. Cori
    Cori avatar
    562 posts
    Member since:
    Jul 2010

    Posted 17 Aug 2010 Link to this post

    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?
  7. Senthil ramna
    Senthil ramna avatar
    67 posts
    Member since:
    Mar 2010

    Posted 17 Aug 2010 Link to this post

    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.
Back to Top