RadAutoCompleteBox Datasource

4 posts, 0 answers
  1. MikeS
    MikeS avatar
    32 posts
    Member since:
    Mar 2014

    Posted 21 May 2014 Link to this post

    Hello

    I have a RadAutoCompleteBox and a datasource associated.

    <telerik:RadAutoCompleteBox ID="RadAutoCompleteBox1" runat="server" DataSourceID="EntityDataSource1" DataTextField="Name" DataValueField="ID">

    This works. if i insert on RadAutoCompleteBox values that doesnt exist in the datasource, they will disapear. it is possible to add extra fields like:

    i filter names like John, Peter --> OK!
    i want to filter by group like 1990, 1991 and then manipulate the values on codebehind to only get people that are born on 1990 or 1991.

    it is possible to do something like that?

    thanks in advance
  2. Shinu
    Shinu avatar
    17764 posts
    Member since:
    Mar 2007

    Posted 21 May 2014 in reply to MikeS Link to this post

    Hi MikeS,

    In order to achieve your scenario please try to set the Name Field as Text and Year field as Id of RadAutoCompleteBox. Based on the value of the selected entries you can write  your code. Please have a look into the following C# code snippet to access all the selected entries of RadAutoCompleteBox.

    C#:
    protected void radbtnGetNodes_Click(object sender, EventArgs e)
    {
        int count = RadAutoCompleteBox1.Entries.Count;
        for (int index = 0; index  < count; index ++)
        {
            string value = RadAutoCompleteBox1.Entries[index].Value;
            //here it will return the value of the selected entries
            //from this you can access all the database item with corresponding value
            //your code
        }
    }

    Another Suggestion is that please try to set the Name as Text Filed and ID as Id Field of RadAutoCompleteBox and from code behind access the Year Field of each selected entry using the ID.

    Thanks,
    Shinu.
  3. UI for ASP.NET Ajax is Ready for VS 2017
  4. MikeS
    MikeS avatar
    32 posts
    Member since:
    Mar 2014

    Posted 21 May 2014 Link to this post

    Hello Shinu
    thanks for the answer.

    i dont think you understand my question... i still want to filter search by name and ID. but i want to pass values on radautocomplete that datasource dont have.

    for example. i want to get 2 values on radautocomplete: John, 1990.
    john exists in the database, 1990 dont... and i want values that dont exist in db so i can manipulate them on codebehind.

    hope i got clear.
    thanks



  5. Shinu
    Shinu avatar
    17764 posts
    Member since:
    Mar 2007

    Posted 21 May 2014 in reply to MikeS Link to this post

    Hi MikeS,

    I am apologizing for misunderstanding your requirement at first.  Telerik RadAutoCompleteBox for ASP.NET AJAX is a powerful drop-down list control which gives the ability to select multiple entries, displaying them as a sequence of strings separated by a delimiter, or fancy styled tokens depending on your preferences. RadAutoCompleteBox needs DataSourceID, DataTextField and DataValueField to select an item from database. So the required scenario is not possible with RadAutoCompleteBox. Please take a look into this help documentation for more information about RadAutoCompleteBox.

    Thanks,
    Shinu.
Back to Top