Preselecting items.

4 posts, 0 answers
  1. JC
    JC avatar
    30 posts
    Member since:
    Feb 2013

    Posted 30 Jul 2013 Link to this post


    Is it possible to preselect item in a radautocompletebox at the time of loading? If possible please help me with some examples?

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

    Posted 30 Jul 2013 Link to this post

    Hi JC,

    As far as I know RadAutoCompleteBox does not support preselecting items, coming from its data source, out-of-the-box. But, you still can manipulate the data source itself so you will be able to have preselected entries. Please have a look at the following code which uses an ASP SQLDataSource.

    <telerik:RadAutoCompleteBox ID="RadAutoCompleteBox2" runat="server" Width="200px"
        DropDownWidth="200px" DataSourceID="SqlDataSource1" DataTextField="Name" DataValueField="ID"
    <asp:SqlDataSource ID="SqlDataSource1" runat="server" ConnectionString="<%$ ConnectionStrings:TelerikConnectionString %>"
        SelectCommand="SELECT [ID], [CountryID], [Name] FROM [Cities]" OnSelecting="SqlDataSource1_Selecting">

    protected void Page_Load(object sender, EventArgs e)
        if (!Page.IsPostBack)
            DataSourceSelectArguments args = new DataSourceSelectArguments();
            DataView view = (DataView)SqlDataSource1.Select(args);
            DataTable table = view.ToTable();
            string ID = "", countryID = "", name = "";
            for (int i = 0; i < table.Rows.Count; i++)
                ID = table.Rows[i].ItemArray[0].ToString();
                countryID = table.Rows[i].ItemArray[1].ToString();
                name = table.Rows[i].ItemArray[2].ToString();
                if (!string.IsNullOrEmpty(ID) && ID == "1")
                    if (!string.IsNullOrEmpty(name))
                        RadAutoCompleteBox2.Entries.Add(new AutoCompleteBoxEntry(name, ID));

  3. Kamelia
    Kamelia avatar
    7 posts
    Member since:
    Sep 2014

    Posted 12 Nov 2014 in reply to Shinu Link to this post

    Hi, Is it possible to preselect items in a radautocompletebox in windows form ???

    I have some items which I want to have them in my radautocompletebox , so I can remove or add items in it . AND I need it to show me the items I had entered before.
    thank you in advance

  4. Nencho
    Nencho avatar
    1646 posts

    Posted 14 Nov 2014 Link to this post


    In order to predefine some entries for the RadAutoCompleteBox, you need to use the Entries collection of the control. Please consider the following approach:

    RadAutoCompleteBox1.Entries.Add(new AutoCompleteBoxEntry("Text", "Value"));


    Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.

Back to Top