Hi,
You can call a method thro a service. Add ServicePath in your html. Create a service and call your method. In my code, the method gets data via Stored Proc, which you can eliminate.
<cc1:AutoCompleteExtender ID="AutoCompleteExtender2" runat="server" CompletionInterval="1000"
CompletionSetCount="12" EnableCaching="true" MinimumPrefixLength="1" ServiceMethod="FindFileNumberMT"
Enabled="true" ServicePath="../AutoFileNew.asmx" TargetControlID="txtFileNumber">
</cc1:AutoCompleteExtender>
using System;
using System.Collections;
using System.Collections.Generic;
using System.Data;
using System.Diagnostics;
using System.Web;
using System.Web.Services;
using System.Web.Services.Protocols;
using System.Data.SqlClient;
using System.Data.Common;
[WebService(Namespace = "http://tempuri.org/")]
[WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)]
[System.Web.Script.Services.ScriptService()]
public class AutoFileNew : System.Web.Services.WebService
{
[WebMethod()]
public string[] FindFileNumberMT(string prefixText, int count)
{
List<string> titleArList = new List<string>();
SqlDataReader dr = null;
SqlCommand oCmd = new SqlCommand("sp_GetAutoFileNumbersNew",Myapplication.mConn);
oCmd.CommandType = CommandType.StoredProcedure;
oCmd.Parameters.Add("@filenumber", SqlDbType.VarChar, 50).Value = prefixText;
try {
dr = oCmd.ExecuteReader();
while (dr.Read()) {
titleArList.Add(dr["file_number"].ToString());
}
return titleArList.ToArray();
} catch (Exception ex) {
} finally {
Myapplication.mConn.Close();
}
}
}