当前位置:编程学习 > C#/ASP.NET >>

AutoCompleteExtender 问题

xialatishi.aspx页面

<%@ Page Language="C#" ValidateRequest="false" AutoEventWireup="true" CodeFile="xialatishi.aspx.cs" Inherits="xialatishi" %>

<%@ Register assembly="AjaxControlToolkit" namespace="AjaxControlToolkit" tagprefix="cc1" %>

<!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 runat="server">
    <title>无标题页</title>
</head>
<body>
    <form id="form1" runat="server">

        <asp:ScriptManager ID="ScriptManager1" runat="server">
        </asp:ScriptManager>

        <cc1:AutoCompleteExtender

             CompletionListCssClass="autocomplete_completionListElement" CompletionListItemCssClass="autocomplete_listItem"
                                            CompletionListHighlightedItemCssClass="autocomplete_highlightedListItem"
            ID="AutoCompleteExtender1" 
            runat="server"
            ServicePath="webservice.asmx"
            TargetControlID="TextBox1" 
            ServiceMethod="GetTextString">
        </cc1:AutoCompleteExtender>
        <asp:TextBox ID="TextBox1" runat="server"></asp:TextBox>


    </form>
</body>
</html>

webservics.cs页面
using System;
using System.Collections;
using System.Linq;
using System.Web;
using System.Web.Services;
using System.Web.Services.Protocols;
using System.Xml.Linq;

/// <summary>
///webservice 的摘要说明
/// </summary>
[WebService(Namespace = "http://tempuri.org/")]
[WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)]
//若要允许使用 ASP.NET AJAX 从脚本中调用此 Web 服务,请取消对下行的注释。 
[System.Web.Script.Services.ScriptService]
public class webservice : System.Web.Services.WebService {

    public webservice () {

        //如果使用设计的组件,请取消注释以下行 
        //InitializeComponent(); 
    }
    [WebMethod]
    public string HelloWorld()
    {
        return "Hello World";
    }

    [WebMethod]
    public string[] GetTextString(string prefixText, int count)
    {
        string[] strArray = new string[count];

        for (int i = 0; i < count; i++)
        {
            strArray[i] = prefixText + i.ToString();
        }

        return strArray;
    }



    
}


为什么没有提示下拉菜单呢?刚接触这块,头大了啊。
补充:.NET技术 ,  ASP.NET
CopyRight © 2012 站长网 编程知识问答 www.zzzyk.com All Rights Reserved
部份技术文章来自网络,