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

RadAutoCompleteBox - provide entries in page load - no postback

3 Answers 146 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
Sunit Carpenter
Top achievements
Rank 1
Sunit Carpenter asked on 08 Apr 2016, 04:33 PM

Hi,

I am using the RadAutoCompleteBox in a sharepoint visual webpart.  I have all the values when I load the webpart.

I am setting the DataSource for the RadAutoCompletebox in page load, but everytime I enter text in the AutoCompleteBox is does a post back.  If I disable postpack, I don't see any type ahead data. 

How do I configure the RadAutoCompleteBox so that I provide it the data it needs at pageload and then it should not do any postbacks?

A related question:

How do I configure RadAutoCompleteBox to function on the client side where it calls a asmx webservice to get the data?

3 Answers, 1 is accepted

Sort by
0
Ivan Danchev
Telerik team
answered on 13 Apr 2016, 11:59 AM
Hello Sunit,

If you bind the AutoCompleteBox in Page_Load you cannot avoid the callbacks to the server that populate it  with data based on the text entered. You can avoid going to the server when entering text if you use webservice binding. Please, see the following documentation article, which demonstrates this type of binding.

Regards,
Ivan Danchev
Telerik
Do you need help with upgrading your ASP.NET AJAX, WPF or WinForms projects? Check the Telerik API Analyzer and share your thoughts.
0
Sunit Carpenter
Top achievements
Rank 1
answered on 15 Apr 2016, 07:19 PM

Ivan..thank you for responding.

I followed the documentation and have run into an issue.

i get the error message "The server method 'GetCompnayNames' failed.".

 

Here is my aspx code.  I tried playing with the web service path.  I put the fully qualifed path and other combinations.

<telerik:radautocompletebox runat="server" id="RadAutoCompleteBox1" onclientrequesting="requesting"><WebServiceSettings Path="/sites/M4/_layouts/my.websrv/Data.asmx" Method="GetCompanyNames" /></telerik:radautocompletebox>

 

Questions:

1. Is the error related to the web service path?  (web service and calling webpart are in the site collecton).

2. How do i get the actual text from radautocomplete? 

i.e context["ClientData"] = RadAutoCompleteBox1.Text?

0
Ivan Danchev
Telerik team
answered on 19 Apr 2016, 03:19 PM
Hello Sunit,

The service path must be specified using tilde (~), so it should be: Path="~/sites/M4/_layouts/my.websrv/Data.asmx"

As for getting the text from the AutoCompleteBox, this can be done in the OnClientRequesting event handler by using the control's get_text() client-side method:
function requesting(sender, eventArgs) {
    var context = eventArgs.get_context();
    context["ClientData"] = sender.get_text();
}


Regards,
Ivan Danchev
Telerik
Do you need help with upgrading your ASP.NET AJAX, WPF or WinForms projects? Check the Telerik API Analyzer and share your thoughts.
Tags
General Discussions
Asked by
Sunit Carpenter
Top achievements
Rank 1
Answers by
Ivan Danchev
Telerik team
Sunit Carpenter
Top achievements
Rank 1
Share this question
or