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

On Demand Loading

5 Answers 178 Views
AutoCompleteBox
This is a migrated thread and some comments may be shown as answers.
Courtenay
Top achievements
Rank 1
Courtenay asked on 08 Feb 2013, 12:35 AM
Hi there,

I have a huge set of data which i need to bind to on demand (on keystroke). Im currently using the AutoCompleteBox in SharePoint which won't allow me to call a webservice in the style that you suggest due to the security within SharePoint:

<WebServiceSettings Path="/_layouts/SP.SyncMatrix/GetSiteData.aspx" Method="GetSites" />

Since you don't allow a client side method of databinding, i was wanting to know if this is the only way of doing on-demand code behind (server side) bind. I did see that there is a ontextchanged method, is there an opportunity to rebind the datasource there?

If not, is there anyway to modify the POST request that your control sends before it is sent? there is the client side onrequesting method but that doesnt seem to allow me to modify the post data at all.

5 Answers, 1 is accepted

Sort by
0
Kalina
Telerik team
answered on 13 Feb 2013, 09:11 AM
Hello Courtenay,

In fact RadAutoCompleteBox uses server-side Load On Demand internally, it is a built-in feature.
So you do not need to implement anything in order to use server-side Load On Demand - simply databind the control.
Here you can find more details about RadAutoCompleteBox databinding.

Greetings,
Kalina
the Telerik team
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 their blog feed now.
0
Kiran
Top achievements
Rank 1
answered on 16 Dec 2013, 12:45 PM

Hello Courtenay,

I don't think loadondemand handles internally by AutoCompleteBox.

Here is the sample code, I have 40 k records (employee names) in datasource. However it hangs to search for filter 'a' . Am I mistaking somewhere ? How to achieve load on demand behavior like combobox in RadAutoCompleteBox. ?

-----------------Code

<telerik:RadAutoCompleteBox ID="RadAutoCompleteBox1" runat="server" DropDownWidth="500px"

    OnDataSourceSelect="RadAutoCompleteBox1_DataSourceSelect" DataSourceID="ObjectDataSource2"    AllowCustomEntry="false"

    DataValueField="Value"     DataTextField="Text"     onclientitemsrequesting="OnClientItemsRequesting"   RegisterWithScriptManager="true" 

        Width="300px" >

</telerik:RadAutoCompleteBox>

protected void RadAutoCompleteBox1_DataSourceSelect(object sender, Telerik.Web.UI.AutoCompleteBoxDataSourceSelectEventArgs e)


{


var dataSource = e.DataSource as ObjectDataSource;

if (dataSource != null)


{


dataSource.SelectParameters["SearchString"].DefaultValue = e.FilterString;


}

}


Best Regards,

Kiran

0
Shinu
Top achievements
Rank 2
answered on 17 Dec 2013, 06:30 AM
Hi Kiran,

Please have a look into the sample code snippet which woks fine at my end.

ASPX:
<telerik:RadAutoCompleteBox ID="RadAutoCompleteBox1" runat="server" DropDownWidth="500px"
    OnDataSourceSelect="RadAutoCompleteBox1_DataSourceSelect" DataSourceID="ObjectDataSource2"
    DataTextField="text" Width="300px" AllowCustomEntry="false" RegisterWithScriptManager="true">
</telerik:RadAutoCompleteBox>
<asp:ObjectDataSource ID="ObjectDataSource2" runat="server" TypeName="Class1">
    <SelectParameters>
        <asp:Parameter Name="textvalue" Type="String" />
    </SelectParameters>
</asp:ObjectDataSource>

C#:
protected void RadAutoCompleteBox1_DataSourceSelect(object sender, AutoCompleteBoxDataSourceSelectEventArgs e)
{
        RadAutoCompleteBox1.DataSourceID = "ObjectDataSource2";
        ObjectDataSource2.SelectMethod = "GetData";
        ObjectDataSource2.SelectParameters["textvalue"].DefaultValue = e.FilterString;
}

Thanks,
Shinu.
0
Kiran
Top achievements
Rank 1
answered on 18 Dec 2013, 04:46 AM
Hi Shinu,

I did the same, it works fine for less records. However, it hangs out for large records.

It should behave like RadComboBox load on demand, it should fetch next 10 records after click on dropdown scroll or navigating items.

Best Regards,

Kiran

 

0
Nencho
Telerik team
answered on 20 Dec 2013, 01:04 PM
Hello Kiran,

Regarding the large amount of data, which is contained in the underlying datasource of the RadAutoCompleteBox the operation would be inevitably slow. However, as you are able to handle and alter the query to your DataBase, you could simply request for the TOP 100 results for example. Thus, you could significantly decrease the returned data and optimize the process.

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
Courtenay
Top achievements
Rank 1
Answers by
Kalina
Telerik team
Kiran
Top achievements
Rank 1
Shinu
Top achievements
Rank 2
Nencho
Telerik team
Share this question
or