Reload autocompletebox text on edit

2 posts, 0 answers
  1. Kevin
    Kevin avatar
    265 posts
    Member since:
    Jun 2011

    Posted 02 Jul 2015 Link to this post

    I have an edit page that is able to edit administrators of a site, on reload or edit of the admin I need to load the name in the autocomplete box and then disable so they cannot change it on edit.  Problem is I can seem to figure out how to reload the autocompletebox with the text.

     

    myDataTable = New DataTable
            myDataTable = getReader(sql)
     
            If myDataTable.Rows.Count > 0 Then
                HFAdminId.Value = myDataTable.Rows(0)(0)
                txtItemSearch.Text = myDataTable.Rows(0)(0).ToString()
                ddlLocations.SelectedValue = myDataTable.Rows(0)(2)
           End If
     
    Also tried this but to no avail.
     
       myDataTable = New DataTable
            myDataTable = getReader(sql)
     
            If myDataTable.Rows.Count > 0 Then
                HFAdminId.Value = myDataTable.Rows(0)(0)
                txtItemSearch.Entries(0).Text = myDataTable.Rows(0)(1).ToString
                ddlLocations.SelectedValue = myDataTable.Rows(0)(2)
             end if
     
    Both gave me this error
     
    Index was out of range. Must be non-negative and less than the size of the collection.
    Parameter name: index
      Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.
     
     Exception Details: System.ArgumentOutOfRangeException: Index was out of range. Must be non-negative and less than the size of the collection.
    Parameter name: index
     
    Source Error:

  2. Bozhidar
    Admin
    Bozhidar avatar
    1101 posts

    Posted 07 Jul 2015 Link to this post

    Hello,

    The AutoCompleteBox uses its entries collection instead of a simple Text or Value property, when it receives input. So in your case you have to do the following:
    RadAutoCompleteBox1.Entries.Clear()
    RadAutoCompleteBox1.Entries.Add(New AutoCompleteBoxEntry("Entry Text"))


    Regards,
    Bozhidar
    Telerik
    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
  3. UI for ASP.NET Ajax is Ready for VS 2017
Back to Top