Setting initial values?

3 posts, 1 answers
  1. Mathew
    Mathew avatar
    27 posts
    Member since:
    Jul 2011

    Posted 17 Jun 2013 Link to this post

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

    Posted 17 Jun 2013 Link to this post

    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.
  3. UI for ASP.NET Ajax is Ready for VS 2017
  4. Mathew
    Mathew avatar
    27 posts
    Member since:
    Jul 2011

    Posted 17 Jun 2013 Link to this post

    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
Back to Top