Good day,,

I am having problem with the autocompleteextender in my application. i already created a webservice..

here is my code

<asp:TextBox ID="txtSKU" runat="server"></asp:TextBox>

            <cc1:AutoCompleteExtender ID="aceSKU" runat="server"
                Enabled="True" 
                ServicePath="http://localhost:3099/WebService1.asmx" 
                ServiceMethod="GetMaterialName"
                TargetControlID="txtSKU" 
                MinimumPrefixLength="2"
                CompletionInterval="100"
                EnableCaching="true"
                ShowOnlyCurrentWordInCompletionListItem="true"    
                 >
            </cc1:AutoCompleteExtender>

and here is my whole webservice code

using System;
using System.Collections;
using System.ComponentModel;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.Services;
using System.Web.Services.Protocols;
using System.Xml.Linq;
using System.Configuration;
using System.Data.SqlClient;
using System.Collections.Generic;
using System.Web.Script.Services;

namespace ProjectArchitecture
{
    /// <summary>
    /// Summary description for WebService1
    /// </summary>
    [WebService(Namespace = "https://microsoft.com/webservices/")]
    //[WebService(Namespace = "http://localhost:3099/WebService1.asmx")]
    [WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)]
    [ToolboxItem(true)]
    // To allow this Web Service to be called from script, using ASP.NET AJAX, uncomment the following line. 
    [ScriptService]
    public class WebService1 : System.Web.Services.WebService
    {


        public WebService1()
        {
        }

        [WebMethod]
        [System.Web.Script.Services.ScriptMethod()]

        public DataTable GetMaterialName(string prefixText, int count)
        {
           SqlConnection con = new SqlConnection(ConfigurationManager.ConnectionStrings["myConn"].ConnectionString);
           con.Open();
            DataSet ds = new DataSet();
           try
           {
               SqlCommand cmd = new SqlCommand("SELECT description FROM PHSROD20.C1DB.DBO.LKPMATERIAL where description like '%" + prefixText + "%'", con);

               SqlDataAdapter da = new SqlDataAdapter();
               da.SelectCommand = cmd;
               da.Fill(ds);
           }
           catch (Exception err)
           {

               string error = err.ToString();
           }
           //SqlCommand cmd = new SqlCommand();

           finally
           {
               con.Close();
           }

          return ds.Tables[0];

        }
    }
}
<asp:TextBox ID="txtSKU" runat="server"></asp:TextBox>

            <cc1:AutoCompleteExtender ID="aceSKU" runat="server"
                Enabled="True" 
                ServicePath="http://localhost:3099/WebService1.asmx" 
                ServiceMethod="GetMaterialName"
                TargetControlID="txtSKU" 
                MinimumPrefixLength="2"
                CompletionInterval="100"
                EnableCaching="true"
                ShowOnlyCurrentWordInCompletionListItem="true"    
                 >
            </cc1:AutoCompleteExtender>

is there any work around here..

once i debug the web service.. it get the record that i filtered by when i enter a string in textbox it doest load the complete string that i wanted to see.. i mean totally nothing passes from the textbox..

i also assign ServicePath to "WebService.asmx". nothing happens also..

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.