Partial match in combo: how to get that entry

3 posts, 1 answers
  1. Tomica
    Tomica avatar
    147 posts
    Member since:
    Apr 2008

    Posted 20 May 2011 Link to this post

    I am using a combo to perform a "contains" search on titles of publications.

    There are cases where I do not want to have the user select a single publication.

    I would like to just accept what they type in for a partial match, and then have a button that sets a SQL select to match all titles in the current combo entry.

    I tested by entering three characters, but on the code-behind I don't know how to retrieve what was entered, as there is nothing "selected".

    How do I grab that entry, preferably without any complicated client-side coding.
    The combo is bound to a SQL datasource and has automatic load on demand enabled.

    Per the online help pages, I think "the control cannot be validated by value out of the box..." is relevant, but I cannot quite understand the client logic, as it pertains to getting beyond "out of the box..." on the server.

    RadComboBox can be easily validated against the Text of its items. This is by design. 
    The control cannot be validated by value out of the box. The combobox is a composite control, its input area being essentially a <input type"text" ...> DOM element. The .value property of this DOM element corresponds to the actual text being written inside the textbox. This is 
  2. Answer
    Kalina avatar
    918 posts

    Posted 25 May 2011 Link to this post

    Hi Tomica,

    As I understand - you want to get the text entered in RadComboBox and perform a SQL Query in order to populate the control with items.
    To achieve this you can use Load On Demand and the RadComboBox.Text property:
    <telerik:RadComboBox ID="RadComboBox1" runat="server"
        DataTextField="name" DataValueField="id"

    protected void RadComboBox1_ItemsRequested(object sender, Telerik.Web.UI.RadComboBoxItemsRequestedEventArgs e)
            string textEntered = RadComboBox1.Text;
            // perform sql query ...

    Please note that RadComboBox items loaded via Load On Demand are not accessible at server-side - that is why you need to use the Text property.
    You can find more details about this topic here.

    All the best,
    the Telerik team

    Browse the vast support resources we have to jump start your development with RadControls for ASP.NET AJAX. See how to integrate our AJAX controls seamlessly in SharePoint 2007/2010 visiting our common SharePoint portal.

  3. Tomica
    Tomica avatar
    147 posts
    Member since:
    Apr 2008

    Posted 25 May 2011 Link to this post

    Yes, this works, although in a slightly different context, as I'm using the automatic load on demand option.

    The vital clue was "text", and I apologize for asking such a "dumb" question, which in effect was
    "How do I get the text that is entered into a combo box that is not any of the "selected" options."

    Answer: "yourcombobox.text"

    I think this is referred to as "Programmer's Myopia", you sometimes miss something that is beyond obvious!
Back to Top