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

  • Home
  • SEARCH
  • 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 608223
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T17:26:24+00:00 2026-05-13T17:26:24+00:00

I want to use AutoCompleteExtender with textbox to auto complete user’s entry from mysql

  • 0

I want to use AutoCompleteExtender with textbox to auto complete user’s entry from mysql database.

but the problem when I run the code and enter a litter should call the webservice method but the problem that the service method return nothing here is my code so please advice me.

<body>
    <form id="form1" runat="server">
    <div>
        <asp:ScriptManager ID="ScriptManager1" runat="server" />

    </div>
    <div>
        <asp:UpdatePanel id="UPSearch" runat="server">
            <ContentTemplate>
                <asp:Panel runat="server" style="position:absolute; top: 48px; left: 10px;">
                    <asp:TextBox ID="txtSearch" runat="server" 
                        style="position:absolute; top: 17px; left: 235px;"></asp:TextBox>
                    <cc1:AutoCompleteExtender ID="ACE_txtSearch" runat="server" TargetControlID="txtSearch" ServiceMethod= "GetByLastName" ServicePath="SearchService.asmx" MinimumPrefixLength="1" >
                    </cc1:AutoCompleteExtender>
                     <asp:RadioButton ID="rdoLastName" runat="server" 
                        style="position:absolute; top: 96px; left: 224px; width: 186px;" 
                        Text="Search By Last Name"/>

                </asp:Panel>
            </ContentTemplate>
        </asp:UpdatePanel>
    </div>
    </form>
</body>

Web Service

namespace Imam_Contacts
{

    [WebService(Namespace = "http://tempuri.org/")]
    [WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)]
    [ToolboxItem(false)]
    // To allow this Web Service to be called from script, using ASP.NET AJAX, uncomment the following line. 
    [System.Web.Script.Services.ScriptService]

    public class SearchService : System.Web.Services.WebService
    {


        [WebMethod]
        public string[] GetByLastName(string prefixText)
        {
         int count = 10;
         string sql = "Select * from contact_info Where Last_Name like @prefixText";
         SqlDataAdapter da = new SqlDataAdapter(sql,"server=localhost;User Id=root;database=contacts;Persist Security Info=True");
         da.SelectCommand.Parameters.Add("@prefixText", SqlDbType.VarChar, 50).Value = prefixText+ "%"; 
         DataTable dt = new DataTable(); 
         da.Fill(dt); 

         string[] items = new string[dt.Rows.Count];
         int i = 0; 
         foreach (DataRow dr in dt.Rows) 
         {
             items.SetValue(dr["Last_Name"].ToString(), i); 
             i++; 
         } 
         return items; 
        }
    }
}
  • 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-05-13T17:26:25+00:00Added an answer on May 13, 2026 at 5:26 pm

    This answer is only relevant if you can’t find a better solution but I’d highly recommend using jQuery and one of the many autocomplete plugins it has available. It’s far more reliable and much more customizable.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I want to use the AutoCompleteExtender control but i want to use it with
I want use glassfish as the solr search server, but I don't know how
I don't want to use a webservice to populate an autocomplete extender on a
I want use a Linq IQueryable Toolkit in project on .NET Compact Framework. The
I want use ajax.net to do some js. like below: ScriptManager.RegisterStartupScript(Submit, typeof(Button), alert, location.href='test.aspx';,
I want use groovy findAll with my param to filtering closure filterClosure = {
I want use html5's new tag to play a wav file (currently only supported
Its really hard to search the any combination of keywords in search engine about
I'm sure I'm going to have to write supporting javascript code to do this.

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.