locked
AJAX AutoComplete not firing RRS feed

  • Question

  • User-1123086518 posted

    In my code I have an AJAX AutoComplete, looks like this:

     

    <asp:TextBox ID="TextBox1" runat="server"></asp:TextBox>
            <ajaxToolkit:AutoCompleteExtender ID="TextBox1_AutoCompleteExtender" runat="server" DelimiterCharacters="" Enabled="True" ServicePath="AutoComplete.asmx" ServiceMethod="GetCompletionList" TargetControlID="TextBox1" CompletionSetCount="10" MinimumPrefixLength="2">
            </ajaxToolkit:AutoCompleteExtender>

    Its fairly straight forward and I have done this kind of thing connecting the Web Service from SQL, however this time within the Web Service I wont to connect to a array from strings. The strings will be the network ID's. The web service looks like:

     

    Imports System.DirectoryServices
    Imports System.DirectoryServices.AccountManagement
    Imports System.Web.Services
    Imports System.Web.Services.Protocols
    Imports System.ComponentModel
    
    ' To allow this Web Service to be called from script, using ASP.NET AJAX, uncomment the following line.
    
    Public Class WebService2
        Inherits System.Web.Services.WebService
    
        <WebMethod()> _
        Public Function GetCompletionList(ByVal prefixText As String, ByVal count As Integer) As List(Of String)
    
            Dim ctx As New PrincipalContext(ContextType.Domain)
    
            Dim group As GroupPrincipal = GroupPrincipal.FindByIdentity(ctx, "####")
            
            ' Create a list of strings.
            Dim list As New List(Of String)
            ' if found....
            If group IsNot Nothing Then
                ' iterate over members            
                For Each p As Principal In group.GetMembers()
                    list.Add(p.SamAccountName)
                Next
            End If
    
            list.Sort()
    
            Return list
        End Function
    

     

    I could chuck the lot into a database beforehand but wouldn't mind trying to solve the problem in the first instance. Anyone got any suggestions?...

    :)

    Tuesday, October 21, 2014 4:32 AM

Answers

  • User1918509225 posted

    Hi crazy_legs,

    First I suggest that you can set a breakpoint on the webservice method,check if it can be hit

    Second,Here is a working demo which you can download for you about how to use ajax autocomplete :

    http://www.aspsnippets.com/Articles/AJAX-AutoCompleteExtender-Example-in-ASPNet.aspx

    http://www.c-sharpcorner.com/UploadFile/munnamax/AutocompleteExtender08062007113854AM/AutocompleteExtender.aspx

    Best Regards,

    Kevin Shen.

    This response contains a reference to a third party World Wide Web site. Microsoft is providing this information as a convenience to you. Microsoft does not control these sites and has not tested any software or information found on these sites; therefore, Microsoft cannot make any representations regarding the quality, safety, or suitability of any software or information found there. There are inherent dangers in the use of any software found on the Internet, and Microsoft cautions you to make sure that you completely understand the risk before retrieving any software from the Internet.

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Wednesday, October 22, 2014 3:36 AM

All replies

  • User-1123086518 posted

    Should also mention I dont get any errors, it just doesnt seem to show the dropdown of results..

    Tuesday, October 21, 2014 4:33 AM
  • User1918509225 posted

    Hi crazy_legs,

    First I suggest that you can set a breakpoint on the webservice method,check if it can be hit

    Second,Here is a working demo which you can download for you about how to use ajax autocomplete :

    http://www.aspsnippets.com/Articles/AJAX-AutoCompleteExtender-Example-in-ASPNet.aspx

    http://www.c-sharpcorner.com/UploadFile/munnamax/AutocompleteExtender08062007113854AM/AutocompleteExtender.aspx

    Best Regards,

    Kevin Shen.

    This response contains a reference to a third party World Wide Web site. Microsoft is providing this information as a convenience to you. Microsoft does not control these sites and has not tested any software or information found on these sites; therefore, Microsoft cannot make any representations regarding the quality, safety, or suitability of any software or information found there. There are inherent dangers in the use of any software found on the Internet, and Microsoft cautions you to make sure that you completely understand the risk before retrieving any software from the Internet.

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Wednesday, October 22, 2014 3:36 AM