<%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="cc1" %>
TargetControlID="txtcon"
ServicePath="Countries.asmx"
ServiceMethod="GetCompletionList"
MinimumPrefixLength="1"
CompletionInterval="1000"
EnableCaching="true"
CompletionSetCount="20"
>
and
web service is Countries.asmx is
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 AjaxControlToolkit;
using System.Data.SqlClient;
using System.Configuration;
using System.Collections.Generic;
using System.Collections.Specialized;
namespace AutocompleteExample
{
///
/// Summary description for Countries
///
[WebService(Namespace = "http://tempuri.org/")]
[WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)]
[ToolboxItem(false)]
// To allow this Web Service to be called from script, using ASP.NET AJAX, //uncomment the following line.
[System.Web.Script.Services.ScriptService]
public class Countries : System.Web.Services.WebService
{
[WebMethod]
[System.Web.Script.Services.ScriptMethod]
public string[] GetCompletionList(string prefixTest,int count)
{
string connStr = ConfigurationManager.ConnectionStrings["san"].ConnectionString;
SqlDataAdapter cmd1 = new SqlDataAdapter("select * from tbl_country where country_name like '" + prefixTest + "%'", connStr);
DataSet ds2 = new DataSet();
cmd1.Fill(ds2, "countries");
DataTable dt1 = ds2.Tables["countries"];
List country = new List(10);
foreach (DataRow dr in dt1.Rows)
{
country.Add(dr["country_name"].ToString());
}
return country.ToArray();
}
}
It is not show any error but web service individual method run but it can not call by .aspx page Textbox when press any char
please solve my problems
Thanx
1 Reply
Know the answer? Post it — somebody with the same question will find it here.
Sign in to answer this question
It is the same account you read, post and publish with — and you will come straight back to this page.

Suthish NairPosted Dec 30, 2010, 2:39 PM