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

RadAutoCompleteBox Datasource

4 Answers 276 Views
AutoCompleteBox
This is a migrated thread and some comments may be shown as answers.
MikeS
Top achievements
Rank 1
MikeS asked on 21 May 2014, 08:42 AM
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

4 Answers, 1 is accepted

Sort by
0
Shinu
Top achievements
Rank 2
answered on 21 May 2014, 09:38 AM
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.
0
MikeS
Top achievements
Rank 1
answered on 21 May 2014, 09:55 AM
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



0
Shinu
Top achievements
Rank 2
answered on 22 May 2014, 04:12 AM
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.
0
Bhavin
Top achievements
Rank 1
answered on 09 Jun 2017, 07:39 AM

Hello Shinu,

             i am getting RadAutocompleteBox.Entries[index].values always blank.please suggest me as soon as possible.pls mail me on bjvaishnav@gmail.com as its urgent

Tags
AutoCompleteBox
Asked by
MikeS
Top achievements
Rank 1
Answers by
Shinu
Top achievements
Rank 2
MikeS
Top achievements
Rank 1
Bhavin
Top achievements
Rank 1
Share this question
or