RadAutoCompleteBox - provide entries in page load - no postback

4 posts, 0 answers
  1. Sunit Carpenter
    Sunit Carpenter avatar
    4 posts
    Member since:
    Jul 2012

    Posted 08 Apr Link to this post

    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?

  2. Ivan Danchev
    Admin
    Ivan Danchev avatar
    835 posts

    Posted 13 Apr Link to this post

    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.
  3. UI for ASP.NET Ajax is Ready for VS 2017
  4. Sunit Carpenter
    Sunit Carpenter avatar
    4 posts
    Member since:
    Jul 2012

    Posted 15 Apr in reply to Ivan Danchev Link to this post

    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?

  5. Ivan Danchev
    Admin
    Ivan Danchev avatar
    835 posts

    Posted 19 Apr Link to this post

    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.
Back to Top