AutoCompleteBox in a RadGrid bound but no results

2 posts, 0 answers
  1. Kenyon
    Kenyon avatar
    2 posts
    Member since:
    Nov 2013

    Posted 14 Jan 2014 Link to this post

    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
  2. Nencho
    Admin
    Nencho avatar
    1457 posts

    Posted 17 Jan 2014 Link to this post

    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.
  3. UI for ASP.NET Ajax is Ready for VS 2017
Back to Top