Click here to Skip to main content
15,073,911 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
I am facing problem in Auto Complete Extender. My auto complete extender in the web project is not working. It not showing any error in the project but it not showing any option related to word that i have entered. I want that when i enter any word then if related word is found in the database then it shows related information. But it shows not any related option. it is not working at all.
Plz help me to solve this problem


below is the code that I have used in web service

C#
using System;
using System.Web;
using System.Collections;
using System.Web.Services;
using System.Web.Services.Protocols;
using System.Data;
using System.Data.SqlClient;
using System.Configuration;

/// <summary>
/// Summary description for AutoComplete
/// </summary>

[WebService(Namespace = "http://tempuri.org/")]
[WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)]
[System.Web.Script.Services.ScriptService]

public class AutoComplete : System.Web.Services.WebService
{
    [WebMethod]
    public string[] GetSuggestions(string prefixText)
    {
        DataSet dtst = new DataSet();
        SqlConnection sqlCon = new SqlConnection(ConfigurationManager.ConnectionStrings["conn"].ConnectionString);
        string strSql = "select Tag from tblTag where Tag like LIKE '" + prefixText + "%' ";
        SqlCommand sqlComd = new SqlCommand(strSql, sqlCon);
        sqlCon.Open();
        SqlDataAdapter sqlAdpt = new SqlDataAdapter();
        sqlAdpt.SelectCommand = sqlComd;
        sqlAdpt.Fill(dtst);
        string[] cntName = new string[dtst.Tables[0].Rows.Count];
        int i = 0;
        try
        {
            foreach (DataRow rdr in dtst.Tables[0].Rows)
            {
                cntName.SetValue(rdr["Tag"].ToString(), i);
                i++;
            }
        }
        catch { }
        finally
        {
            sqlCon.Close();
        }
        return cntName;
    }
}
Posted
Updated 2-Oct-11 6:07am
v3
Comments
[no name] 21-Aug-10 11:42am
   
Perhaps if you showed some of the code, how you have it configured, maybe we can help better
Sandeep Mewara 21-Aug-10 23:12pm
   
This is not the desired behaviour. You must be doing somethin wrong. As suggested please update with some code.

ok even though you didnt put up any code which could enable anyone help you here, I would want to remind you that you need to check your sql wildcards well, it usually forms the key to auto-completes..

and then you then need to make a few adjustments on the front-end to enable your auto-complete work. and one very best thing to do in that regard is to integrate AJAX and therefore implement someHTTPRequest's to your server (database host)..

ok..thats about a few advice I can give you..:)
   
Please refer my article as even i am using the same, but with no error.

Using Ajax AutoCompleteExtender for autosuggest
   
v2
Comments
aryan2010 3-Oct-11 5:34am
   
Check the link please
You have provided my questions link
Anuja Pawar Indore 3-Oct-11 6:31am
   
Updated pls check now

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)




CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900