yorro -6 Junior Poster

Hi,

I am using the AjaxControlToolkit's AutoCompleteExtender without a Web Service(PageMethod). It is working fine on my local machine, but AutoCompleteExtender won't work in the IIS but other AjaxControlToolkit does.

I've searched around but none applies to my problem.

It is running in IIS-6, and Framework 4.0.

Heres my code:

<!-- Auto Suggestion -->
<ajaxToolkit:AutoCompleteExtender 
    runat="server" 
    ID="ajaxAutoCompleteEmpNo" 
    ServiceMethod="GetCompletionList" 
    TargetControlID="txtEmpNo" 
    MinimumPrefixLength="1" 
    CompletionInterval="100" 
    CompletionSetCount="10" >
</ajaxToolkit:AutoCompleteExtender>

// Auto complete method
[System.Web.Script.Services.ScriptMethod]
[System.Web.Services.WebMethod]
public static string[] GetCompletionList(string prefixText, int count)
{

    List<string> strResult = new List<string>();
    OdbcConnection con = new OdbcConnection(ConfigurationManager.ConnectionStrings["csdbETSMain"].ConnectionString);
    con.Open();

    OdbcCommand cmd = new OdbcCommand("SELECT EmpNo FROM dbetsmain.tblusers WHERE EmpNo LIKE ? LIMIT ?", con);
    cmd.Parameters.Add("EmpNo",OdbcType.VarChar, 4).Value = prefixText + '%';
    cmd.Parameters.Add("Limit", OdbcType.Int).Value = count;

    OdbcDataReader dr = cmd.ExecuteReader();
    while (dr.Read())
    {
        strResult.Add(dr.GetValue(0).ToString());
    }


    return strResult.ToArray();
}

Please help

Be a part of the DaniWeb community

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