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
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
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
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.
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
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