AutoComplete List Selection is Not Appearing

2 posts, 0 answers
  1. Patrick
    Patrick avatar
    4 posts
    Member since:
    Sep 2008

    Posted 28 Aug 2014 Link to this post


    I have this in my aspx page:

             ID="MyControl" runat="server" Width="400" DropDownHeight="150"

    In my code-behind, I have this:

    01.Public Function MySelectMethod() As AutoCompleteBoxData
    02.    Dim data As DataTable = GetChildNodes("a", "139")
    03.    Dim result As New List(Of AutoCompleteBoxItemData)()
    05.    For Each row As DataRow In data.Rows
    06.        Dim childNode As New AutoCompleteBoxItemData()
    07.        childNode.Text = row("field1").ToString()
    08.        childNode.Value = row("field2").ToString()
    09.        result.Add(childNode)
    10.    Next
    12.    Dim res As New AutoCompleteBoxData
    13.    res.Items = result.ToArray()
    15.    Return res
    16.End Function
    18.Private Function GetChildNodes(ByVal searchString As String, ByVal countryList As String) As DataTable
    19.    ' Some code that works
    20.End Function
    22.Private Function GetData(selectCommand As SqlCommand) As DataTable
    23.    ' Some code that works
    24.End Function

    MySelectMethod is returning the records that I am expecting, given that the parameters are hardcoded. However this are the problems that I encounter:

    1) The list of records is not appearing. 
    2) My text-input goes away after getting the list of records
    3) MyControl.Text property is empty

    Anyhelp on this one? I badly need specifically #3 since it is a parameter that I need to pass dynamically. 

  2. Nencho
    Nencho avatar
    1661 posts

    Posted 01 Sep 2014 Link to this post

    Hello John,

    The SelectMethod is an inherited method from the WebControl and instead of using it for populating the control with data, you should directly specify the DataSource with the needed data. Please refer to the following online demo and documentation article, providing more details on the matter :


    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