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 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 AutoCompleteExtender for autocomplete in TextBox. But not getting the results.
I want use from multiple upload image in codeigniter but problem is here that
I want to use the AutoCompleteExtender control but i want to use it with
I want use ORDER BY RAND() query mysql. But I have some question want
I want use Kendo ui window, but I can't see what the problem is.
I want use MySQL database in R environment. I am using Ubuntu OS. To
i want use some data from a website with web service. i have a
I want use JQuery mobile for the front-end of my mobile application, but I
Im trying to do simple audio player, but I want use a image(icon) as
I want to generate Full and Partially Call Trees from cscope database of c

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.