Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8042333
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T04:32:36+00:00 2026-06-05T04:32:36+00:00

Trying to get an autocomplete to work an a textbox but it seems that

  • 0

Trying to get an autocomplete to work an a textbox but it seems that the code behind method is never firing. Can anyone see the issue from below? I have tried various samples/tutorials to no effect.

<asp:ScriptManager ID="SM1" runat="server"></asp:ScriptManager>
    <asp:UpdatePanel ID="UpdatePanel" runat="server">
        <ContentTemplate>
            <asp:TextBox ID="txtUserName" runat="server"></asp:TextBox>
            <ajaxToolkit:AutoCompleteExtender ID="AutoCompleteExtender1" runat="server" TargetControlID="txtUserName" ServiceMethod="GetCompletionList"
            MinimumPrefixLength="2" CompletionInterval="10" EnableCaching="true" CompletionSetCount="3" UseContextKey="True">
            </ajaxToolkit:AutoCompleteExtender>
        </ContentTemplate>
    </asp:UpdatePanel>

code behind:

[System.Web.Services.WebMethodAttribute(), System.Web.Script.Services.ScriptMethod()]
public static string[] GetCompletionList(string prefixText, int count, string contextKey)
{
   string connectionString = ConfigurationManager.ConnectionStrings["WMSDatabase"].ConnectionString;
   SqlConnection conn = new SqlConnection(connectionString);
   // Try to use parameterized inline query/sp to protect sql injection
   SqlCommand cmd = new SqlCommand("SELECT TOP " + count + " Alias FROM dbo.Users WHERE Alias LIKE '" + prefixText + "%'", conn);
   SqlDataReader oReader;
   conn.Open();
   List<string> CompletionSet = new List<string>();
   oReader = cmd.ExecuteReader(CommandBehavior.CloseConnection);
   while (oReader.Read())
   CompletionSet.Add(oReader["Alias"].ToString());
   return CompletionSet.ToArray();
}
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-05T04:32:38+00:00Added an answer on June 5, 2026 at 4:32 am

    Try removing the update panel from your code:

    <asp:ScriptManager ID="SM1" EnablePageMethods="true" runat="server"></asp:ScriptManager>
                <asp:TextBox ID="txtUserName" runat="server"></asp:TextBox>
                <ajaxToolkit:AutoCompleteExtender ID="AutoCompleteExtender1" runat="server" TargetControlID="txtUserName" ServiceMethod="GetCompletionList"
                MinimumPrefixLength="2" CompletionInterval="10" EnableCaching="true" CompletionSetCount="3" UseContextKey="True">
                </ajaxToolkit:AutoCompleteExtender>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm trying to do an autocomplete to my textbox, but it doesn't work. Follow
I'm trying to get YUIs DataTable to work using Inline Cell Editing that can
I'm trying to get autocomplete to work on clones by using delegate, but it
I'm trying to get the jQuery UI autocomplete widget to work but I'm having
I am trying to get autocomplete working working with JQuery UI, but I am
Trying to get comfortable with jQuery and I have encountered some sample code that
I am trying to get AutoComplete to work on a website application I am
First off, it is nice that they are trying to get code completion on
Possible Duplicate: Trying to get tag-it to work with an AJAX call How can
I've been trying to get autocomplete to work, however, I am getting a weird

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.