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

Setting initial values?

2 Answers 80 Views
AutoCompleteBox
This is a migrated thread and some comments may be shown as answers.
Mathew
Top achievements
Rank 1
Mathew asked on 17 Jun 2013, 08:13 AM
Is there a way to select and display already selected tokens for the AutoCompleteBox? I can't see anything in the documentation or demos about this.

I want to show existing selections, while still allowing the user to add to or remove their selections.

Thanks

2 Answers, 1 is accepted

Sort by
0
Accepted
Shinu
Top achievements
Rank 2
answered on 17 Jun 2013, 09:33 AM
Hi,

You can try the following code snippet to set initial values.
C#:
protected void Page_Load(object sender, EventArgs e)
{
    if (!IsPostBack)
    {
        AutoCompleteBoxEntry entry1 = new AutoCompleteBoxEntry();
        entry1.Text = "James";
        entry1.Value = "1";
        RadAutoCompleteBox1.Entries.Add(entry1);
        AutoCompleteBoxEntry entry2 = new AutoCompleteBoxEntry();
        entry2.Text = "Brian";
        entry2.Value = "2";
        RadAutoCompleteBox1.Entries.Add(entry2);
     }   
}

Thanks,
Shinu.
0
Mathew
Top achievements
Rank 1
answered on 17 Jun 2013, 09:46 AM
Hi Shinu,

I was just going to post that I'd figured out you could do this by modifying the entries collection!

Many thanks,
Mathew
Tags
AutoCompleteBox
Asked by
Mathew
Top achievements
Rank 1
Answers by
Shinu
Top achievements
Rank 2
Mathew
Top achievements
Rank 1
Share this question
or