Combobox Filter

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

    Posted 18 Aug 2010 Link to this post

    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. Answer
    Princy
    Princy avatar
    17421 posts
    Member since:
    Mar 2007

    Posted 19 Aug 2010 Link to this post

    Hello Senthil,

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

    Thanks,
    Princy.
  3. Senthil ramna
    Senthil ramna avatar
    67 posts
    Member since:
    Mar 2010

    Posted 20 Aug 2010 Link to this post

    Thanks a lot princy that did the trick.
Back to Top