AutoCompleteBox lose tokens and functionality after form postback

4 posts, 0 answers
  1. Eugene
    Eugene avatar
    2 posts
    Member since:
    Dec 2013

    Posted 08 Aug 2014 Link to this post

    Hi

    Im using the AutoCompleteBox control to search items via a Web Api and selected value then stored as token. When submitting the form the saving of the tokens work fine but the token no longer appear in the box - its as if its lost from the view state. The functionality to search again is also lost from the box.

    Any ideas or advise, see ASPX markup below:

    <telerik:RadAutoCompleteBox runat="server" ID="RadAutoCompleteCostCenter" EmptyMessage="Search" Width="100%" ViewStateMode="Enabled" EnableViewState="true"
    InputType="Token" DropDownPosition="Automatic" DropDownWidth="550" DropDownHeight="200" OnClientRequesting="autoComplete.Requesting" Skin="MetroTouch" MinFilterLength="3" >
    <WebServiceSettings Method="search" Path="~/api/cost/" />
    </telerik:RadAutoCompleteBox>

  2. Shinu
    Shinu avatar
    17764 posts
    Member since:
    Mar 2007

    Posted 08 Aug 2014 in reply to Eugene Link to this post

    Hi Eugene,

    Unfortunately I couldn't replicate the issue at my end. Please have a look into this sample code snippet which works fine at my end.

    ASPX:
    <telerik:RadAutoCompleteBox runat="server" ID="RadAutoCompleteBox1" EmptyMessage="Search"
        Width="100%" ViewStateMode="Enabled" EnableViewState="true" DropDownPosition="Automatic"
        DropDownWidth="550" DropDownHeight="200" OnClientRequesting="requesting" Skin="MetroTouch"
        MinFilterLength="1">
        <WebServiceSettings Path="LoadEntries.asmx" Method="GetCompanyNames" />
    </telerik:RadAutoCompleteBox>
    <telerik:RadButton ID="rbtnSave" runat="server" Text="Save Data" OnClick="rbtnSave_Click">
    </telerik:RadButton>

    C#:
    protected void rbtnSave_Click(object sender, EventArgs e)
    {
        System.Collections.ArrayList list = new System.Collections.ArrayList();
        foreach (AutoCompleteBoxEntry entry in RadAutoCompleteBox1.Entries)
        {
            list.Add(entry.Text);
        }
    }

    JavaScript:
    function requesting(sender, eventArgs) {
        var context = eventArgs.get_context();
    }

    Thanks,
    Shinu.
  3. UI for ASP.NET Ajax is Ready for VS 2017
  4. Eugene
    Eugene avatar
    2 posts
    Member since:
    Dec 2013

    Posted 08 Aug 2014 in reply to Shinu Link to this post

    Hi Shinu

    Im still having the same issue and my code is exactly as yours. The only difference is that my form is inside a RadAjaxPanel - could this cause an issue? I also have 3 other RadAutoCompleteBoxes on the form, all 3 behaving exactly the same. So my suspicion is the RadAjaxPanel?

    Eugen
  5. Shinu
    Shinu avatar
    17764 posts
    Member since:
    Mar 2007

    Posted 11 Aug 2014 in reply to Eugene Link to this post

    Hi Eugene,

    Unfortunately I Couldn't replicate the issue at my end.

    Thanks,
    Shinu.
Back to Top