index.aspx页面
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="index.aspx.cs" Inherits="index"%>
<%@ Register Assembly="AjaxControlToolkit20" Namespace="AjaxControlToolkit20" TagPrefix="cc1" %>
<%@ Register Src="~/usr_control/daohangtu.ascx" TagName="daohangtu" TagPrefix="daohangtu"%>
<%@ Register Src="~/usr_control/daohanglan.ascx" TagName="daohanglan" TagPrefix="daohanglan"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <title>首页</title>
    <link href="css/index.css" rel="stylesheet" type="text/css"/>
    <style type="text/css">
        body,td,th 
        {
       font-family: 宋体;
       margin:4px 4px 4px 4px;
        }
        .STYLE3
        {
            font-family: "新宋体"; 
            color: #FF6600; 
        }
        a 
        {
          text-decoration:none;
        }
        .sousuo
{
      width:1257px;
      height:90px;
      background-color:#f60;
      position:absolute;
      top:130px;
      left:0px;
      font-color:white;
          text-align:center;
}
</style>
</head>
    <body>
        <form id="Form" runat="server" action="#" method="post">
            <cc1:ToolkitScriptManager ID="ToolkitScriptManager1" runat="server" ScriptMode="release">
            </cc1:ToolkitScriptManager>
                        <div><daohangtu:daohangtu Id="daohangtu" runat="server"></daohangtu:daohangtu></div>
                        <div class="sousuo">
                             &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 
                          
                            <asp:UpdatePanel ID="UpdatePanel1" runat="server">
                            <ContentTemplate >
                              <asp:TextBox runat="server" ID="keyword" Width="260px" Height="22px" BackColor="white"></asp:TextBox>
                               <asp:Button Text="搜索" ID="search" runat="server" Height="30px" OnClick="search_Click" />
                                <cc1:AutoCompleteExtender 
                                 CompletionListElementID="mydrop" 
                                 ID="AutoCompleteExtender1"  
                                 ServicePath="WebServiceAutoCompleteExtender.asmx" 
                                 CompletionInterval="1000" 
                                 EnableCaching="true"  
                                 CompletionSetCount="12" 
                                 ServiceMethod="Get" 
                                 TargetControlID="keyword" 
                                 MinimumPrefixLength="1" 
                                 runat="server">
                                 </cc1:AutoCompleteExtender> 
                            </ContentTemplate>
                            </asp:UpdatePanel>
</form>
</body>
</html>
WebServiceAutoCompleteExtender.asmx页面
<%@ WebService Language="C#" CodeBehind="~/App_Code/WebServiceAutoCompleteExtender.cs" Class="WebServiceAutoCompleteExtender" %>
WebServiceAutoCompleteExtender.cs页面using System;
using System.Web;
using System.Collections;
using System.Web.Services;
using System.Web.Services.Protocols;
using System.Data; 
using System.Data.SqlClient; 
/// <summary>
/// WebServiceAutoCompleteExtender 的摘要说明
/// </summary>
[WebService(Namespace = "http://tempuri.org/")]
[WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)]
public class WebServiceAutoCompleteExtender : System.Web.Services.WebService {    public WebServiceAutoCompleteExtender () {        //如果使用设计的组件,请取消注释以下行 
        //InitializeComponent(); 
    }    [WebMethod]
    public string[] Get(string prefixText, int count)
    {
        Produce p = new Produce();
        System.Data.DataTable dt = p.GetProduce2(prefixText, count.ToString()).Tables[0];
        string[] result = new string[dt.Rows.Count];
        for (int i = 0; i < dt.Rows.Count; i++)
        {
            result.SetValue(dt.Rows[i][0].ToString(), i);
        }
        return result;
    }
}produce.cs页面using System;
using System.Collections.Generic;
using System.Text;
using System.Data;
using System.Data.SqlClient;
using System.Web.Services;
public class Produce
{
    public SqlConnection GetConn()
    {
        string str="Data Source=WANGQINGSONG;Database=yishizhuxing;User id=wangyuhua;pwd='12345678'";
        SqlConnection sqlcon=new SqlConnection(str);
        return sqlcon;
    }
 public DataSet GetProduce2(string name, string count)
    {
        string nameLength = Convert.ToString(name.Length); //输入的长度        return GetDS("SELECT top " + count + " [prod_name]] FROM produce WHERE left(ltrim([prod_name]])," + nameLength + ")='" + name + "'");
    }
}为什么不能实现类似百度下拉列表呢??请教各位。。我是初学者,谢谢。。