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

AutoCompleteBox in a RadGrid bound but no results

1 Answer 81 Views
AutoCompleteBox
This is a migrated thread and some comments may be shown as answers.
Kenyon
Top achievements
Rank 1
Kenyon asked on 14 Jan 2014, 11:25 PM
Hi there,

I have an auto complete box in my RadGrid.  I've got it binding with ItemDataBound and populating with a previously selected value, but it doesn't start auto-completing when I clear out the data and type something new.  I've had a Google around, but haven't been able to find where I'm going wrong.
<telerik:GridTemplateColumn DataField="ProgramOfficerName"
    FilterControlAltText="Filter TemplateColumnArgumentOfficerName column"
    HeaderText="Argument Officer Name 2"
    UniqueName="TemplateColumnArgumentOfficerName">
    <ItemTemplate>
        <telerik:RadAutoCompleteBox ID="radAutoCompleteTest" Runat="server" InputType="Text" TextSettings-SelectionMode="Single">
            <TextSettings SelectionMode="Single" />
        </telerik:RadAutoCompleteBox>
    </ItemTemplate>
</telerik:GridTemplateColumn>



Protected Sub gridCommentingOfficers_ItemDataBound(sender As Object, e As Telerik.Web.UI.GridItemEventArgs) Handles gridCommentingOfficers.ItemDataBound
    Dim item As GridDataItem = TryCast(e.Item, GridDataItem)
    Dim dtUsers As DataTable = _functions.Get_AsDataTable("select eDistinguishedName, eUserName from Metastorm.dbo.eUser")
 
    If Not item Is Nothing Then
        Dim auto As RadAutoCompleteBox = item.FindControl("radAutoCompleteTest")
        auto.Entries.Add(New AutoCompleteBoxEntry(item("columnProgramOfficerName").Text, item("columnProgramOfficerLogin").Text))
        auto.DataTextField = "eDistinguishedName"
        auto.DataValueField = "eUserName"
        auto.DataSource = dtUsers
        auto.DataBind()
    End If
End Sub

1 Answer, 1 is accepted

Sort by
0
Nencho
Telerik team
answered on 17 Jan 2014, 02:52 PM
Hello Kenyon,

The RadAutoCompleteBox uses callbacks, in order to request its underlying datasource. Each time a character is typed, the callback is trigger for querying the entries. Since the control uses callback mechanism it should be supplied with its datasource not later than the Page_Load event. As I can see, you are providing the datasource at ItemDataBound event handler. Please consider using the Page_Load event, as suggested above.

Regards,
Nencho
Telerik
If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to the blog feed now.
Tags
AutoCompleteBox
Asked by
Kenyon
Top achievements
Rank 1
Answers by
Nencho
Telerik team
Share this question
or