This is a migrated thread and some comments may be shown as answers.

Reload autocompletebox text on edit

1 Answer 57 Views
AutoCompleteBox
This is a migrated thread and some comments may be shown as answers.
Kevin
Top achievements
Rank 1
Kevin asked on 02 Jul 2015, 06:46 PM

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:

1 Answer, 1 is accepted

Sort by
0
Bozhidar
Telerik team
answered on 07 Jul 2015, 07:53 AM
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
Tags
AutoCompleteBox
Asked by
Kevin
Top achievements
Rank 1
Answers by
Bozhidar
Telerik team
Share this question
or