Items not display in AutocompleteBox from serverside databinding

2 posts, 0 answers
  1. Rahul
    Rahul avatar
    39 posts
    Member since:
    Jan 2014

    Posted 29 Jan 2014 Link to this post

          In my case I have one  AutoCompleteBox. Its Databinding  From Server Side i.e.code behind. but Data not showing in AutoCompleteBox so provide solution.
    My code is..
    Client Side:
    <telerik:RadAutoCompleteBox ID="cmplt_agent" Runat="server" InputType="Token" 
                                                                        Width="80%"  Filter="StartsWith"
                                                                        DropDownWidth="200" DropDownHeight="150" AllowCustomEntry="true"
                                                                        ontextchanged="cmplt_agent_TextChanged" >       
                                                                     <TokensSettings AllowTokenEditing="true" /> 

    code behind:
      public void GetAgent()
                AgentIdTitle = cs.GetAgentIdTitle(Ld.SubscriberInformationId);
                cmplt_agent.DataSource = AgentIdTitle;
                cmplt_agent.DataTextField = "Title";
                cmplt_agent.DataValueField = "Id";

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

    Posted 29 Jan 2014 in reply to Rahul Link to this post

    Hi Rahul,

    Please have a look into the sample code snippet which works fine at my end.

    <telerik:RadAutoCompleteBox ID="RadAutoCompleteBox1" runat="server" DropDownHeight="150"
        Width="80%" InputType="Token" DropDownWidth="200" Filter="StartsWith" AllowCustomEntry="true">
        <TokensSettings AllowTokenEditing="true" />

    protected void Page_Load(object sender, EventArgs e)
    public void GetAgent()
        String connstring = WebConfigurationManager.ConnectionStrings["NorthwindConnectionString"].ConnectionString;
        SqlConnection conn = new SqlConnection(connstring);
        SqlDataAdapter adapter = new SqlDataAdapter();
        adapter.SelectCommand = new SqlCommand("SELECT * from City ", conn);
        DataTable data = new DataTable();
            RadAutoCompleteBox1.DataSource = data;
            RadAutoCompleteBox1.DataTextField = "Cityname";
            RadAutoCompleteBox1.DataValueField = "Countryname";

Back to Top