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

AutoCompleteBox lose tokens and functionality after form postback

3 Answers 29 Views
AutoCompleteBox
This is a migrated thread and some comments may be shown as answers.
Eugene
Top achievements
Rank 1
Eugene asked on 08 Aug 2014, 08:28 AM
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>

3 Answers, 1 is accepted

Sort by
0
Shinu
Top achievements
Rank 1
answered on 08 Aug 2014, 10:45 AM
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.
0
Eugene
Top achievements
Rank 1
answered on 08 Aug 2014, 11:06 AM
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
0
Shinu
Top achievements
Rank 1
answered on 11 Aug 2014, 09:10 AM
Hi Eugene,

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

Thanks,
Shinu.
Tags
AutoCompleteBox
Asked by
Eugene
Top achievements
Rank 1
Answers by
Shinu
Top achievements
Rank 1
Eugene
Top achievements
Rank 1
Share this question
or