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

Page is being refreshed when OnEntryAdded callback function is triggered...

2 Answers 116 Views
AutoCompleteBox
This is a migrated thread and some comments may be shown as answers.
Yan Moura
Top achievements
Rank 1
Veteran
Iron
Yan Moura asked on 03 Jun 2020, 07:58 PM
I am using AutoCompleteBox in an ASPX page with VB in code behind. I have a callback function 'OnEntryAdded' and every time this function is triggered my page is being refreshed. What am I doing wrong?

This is my ASPX code:

<form id="form1" runat="server">
<telerik:RadScriptManager runat="server" ID="RadScriptManager1" />
<telerik:RadAutoCompleteBox
    RenderMode="Lightweight"
    runat="server"
    ID="RadAutoCompleteBox1"
    autopostback="true" EmptyMessage="Type in data..."
    DataSourceID="SqlDataSource1"
    DataTextField="edesc"
    DataValueField="ecode"
    InputType="Token"
    Width="100%"
    DropDownWidth="150px"
    OnEntryAdded="RadAutoCompleteBox1_EntryAdded"
    >
</telerik:RadAutoCompleteBox>
 
<asp:SqlDataSource runat="server"
    ID="SqlDataSource1"
    CancelSelectOnNullParameter="False"
    ConnectionString="<%$ AppSettings:MyConn %>"
    SelectCommand="exec dbo.myquery">
</asp:SqlDataSource>
</form>

This is my code behind

Imports System.Diagnostics
Imports Telerik.Web.UI
Imports System.Data.SqlClient
 
Partial Class custom_scripts_blah
    Inherits System.Web.UI.Page
 
    Protected Sub RadAutoCompleteBox1_EntryAdded(sender As Object, e As Telerik.Web.UI.AutoCompleteEntryEventArgs)
    End Sub
 
End Class

 

 

Any idea?

2 Answers, 1 is accepted

Sort by
0
Peter Milchev
Telerik team
answered on 08 Jun 2020, 10:39 AM

Hello Yan,

The OnEntryAdded event is a server-side event that requires a postback. 

The Callback is used only for populating the data when the dropdown is shown while filtering and choosing items.

You can wrap the control in an AjaxPanel/asp:UpdatePanel or add it as an UpdatedControl in the AjaxSettings of the RadAjaxManager which will update only the AutoCompleteControl when the OnEntryAdded is fired, instead of refreshing the whole page.

Regards,
Peter Milchev
Progress Telerik

Progress is here for your business, like always. Read more about the measures we are taking to ensure business continuity and help fight the COVID-19 pandemic.
Our thoughts here at Progress are with those affected by the outbreak.
0
Yan Moura
Top achievements
Rank 1
Veteran
Iron
answered on 23 Jun 2020, 07:21 PM
Thank you Peter. It was my bad. Ajax wasn't active. It's solved now.
Tags
AutoCompleteBox
Asked by
Yan Moura
Top achievements
Rank 1
Veteran
Iron
Answers by
Peter Milchev
Telerik team
Yan Moura
Top achievements
Rank 1
Veteran
Iron
Share this question
or