$(document).ready(function(){ $("#<%=fname.ClientID%>").autocomplete("TestHandler.ashx"); });
where fname is your textbox name .
In TestHandler.ashx write the below code:
using System;
using System.Web;
using System.Data;
public class TestHandler : IHttpHandler
{
public void ProcessRequest(HttpContext context)
{
string Dealercode = context.Request.QueryString["q"];
DataSet objds = new DataSet();
//get the dataset from your class.Here dataprocessor is a class having
//runspreturndataset method which will return the dataset.
objds = DataProcessor.RunSpReturnDataset("get_dealer_details", Dealercode);
string[] items = new string[objds.Tables[0].Rows.Count];
foreach (DataRow dr in objds.Tables[0].Rows)
{
//items.SetValue(dr["dealercode"].ToString(), Convert.ToInt32(dr["tmsw_dealer_id"].ToString()));
context.Response.Write(dr["dealer_code"].ToString().TrimEnd() +"-"+ dr["dealership_name"].ToString().Trim() + Environment.NewLine);
}
}
public bool IsReusable
{
get
{
return false;
}
}
}