Skip to content

Auto complete extender not working in master page.

Salma Swalahin

Asked Mar 24, 2015, 4:34 AM EDT2 answers
Share
LinkedInX
Here is my master.master page code-
 
<%@ Master Language="C#" AutoEventWireup="true" CodeFile="MasterPage.master.cs" Inherits="MasterPage" %>

<%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="asp" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">


















Search County


CompletionInterval="10" EnableCaching="true" CompletionSetCount="12" TargetControlID="TextBox1"
ID="AutoCompleteExtender1" runat="server" FirstRowSelected="false" UseContextKey="false">












here is my webservice.asmx page code--
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Services;
using System.Data;
using System.Configuration;
using System.Data.SqlClient;
using System.Web.Services.Protocols;
using System.Web.Script.Services;

///
/// Summary description for WebService
///
[WebService(Namespace = "http://tempuri.org/")]
[WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)]
// 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 WebService : System.Web.Services.WebService {

public WebService () {

//Uncomment the following line if using designed components
//InitializeComponent();
}

[WebMethod]
[System.Web.Script.Services.ScriptMethod()]

public List GetCompletionList(string prefixText, int count)
{
using (SqlConnection con = new SqlConnection())
{
con.ConnectionString = ConfigurationManager.ConnectionStrings["Constr"].ConnectionString;

using (SqlCommand com = new SqlCommand())
{
com.CommandText = "select SubCatname from [findeasy].[Sub_Category_Table] where " + "SubCatname like @Search + '%'";

com.Parameters.AddWithValue("@Search", prefixText);
com.Connection = con;
con.Open();
List countryNames = new List();
using (SqlDataReader sdr = com.ExecuteReader())
{
while (sdr.Read())
{
countryNames.Add(sdr["SubCatname"].ToString());
}
}
con.Close();
return countryNames;
}
}
} 
and I add a default page for debug the masterpage.
Please help ?????

2 Answers

Know the answer? Post it. Somebody with the same question will find it here.