atlas:AutoCompleteExtender Demo

AutoComplete.aspx

<%@ Page Language="C#" ClassName="Samples.ScriptManagerControl" %>

<!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>AutoCompleteExtender Control Sample</title>

    <atlas:ScriptManager runat="server" />

</head>
<body>

    <form id="form1" runat="server">
    <div>
        <h1>AutoCompleteExtender Control Sample</h1>
        <p>This sample demonstrates the use of an <a href="../Microsoft.Web.UI.Controls/AutoCompleteExtender/default.aspx">AutoCompleteExtender</a> control. As soon as you type a letter, a drop-down panel with possible completion values appears below the text box. Use either the mouse or arrow keys to select one of the suggestions, or keep typing for more options.</p>

        <p>Search Text: <asp:TextBox ID="searchText" runat="server" /></p>
        <atlas:AutoCompleteExtender ServicePath="AutoCompleteService.asmx" ServiceMethod="GetSuggestions" MinimumPrefixLength="1" runat="server">
            <atlas:AutoCompleteProperties TargetControlID="searchText" Enabled="true" />
        </atlas:AutoCompleteExtender>
    </div>
    </form>

</body>
</html>


AutoCompleteService.asmx
<%@ WebService Language="C#" Class="SamplesService" %>

using System;
using System.Web;
using System.Web.Services;
using System.Web.Services.Protocols;

[WebService(Namespace = "http://tempuri.org/")]
[WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)]
public class SamplesService  : System.Web.Services.WebService {

    [WebMethod]
    public string[] GetSuggestions(string prefixText, int count) {
        string[] r = new string[count];
        for (int i = 0; i < r.Length; i++)
            r[i] = string.Format("{0} ({1})", prefixText, i);
        return r;
    }
}

Web.config
<?xml version="1.0"?>
<configuration xmlns="http://schemas.microsoft.com/.NetConfiguration/v2.0">

  <configSections>
    <sectionGroup name="microsoft.web" type="Microsoft.Web.Configuration.MicrosoftWebSectionGroup">
      <section name="converters" type="Microsoft.Web.Configuration.ConvertersSection" requirePermission="false" />
      <section name="webServices" type="Microsoft.Web.Configuration.WebServicesSection" requirePermission="false" />
      <section name="authenticationService" type="Microsoft.Web.Configuration.AuthenticationServiceSection" requirePermission="false" />
      <section name="profileService" type="Microsoft.Web.Configuration.ProfileServiceSection" requirePermission="false" />
    </sectionGroup>
  </configSections>

  <microsoft.web>
    <converters>
      <add type="Microsoft.Web.Script.Serialization.Converters.DataSetConverter"/>
      <add type="Microsoft.Web.Script.Serialization.Converters.DataRowConverter"/>
      <add type="Microsoft.Web.Script.Serialization.Converters.DataTableConverter"/>
    </converters>
    <webServices enableBrowserAccess="true" />
  </microsoft.web>
  <appSettings/>
  <connectionStrings/>
  <system.web>
    <pages>
      <controls>
        <add namespace="Microsoft.Web.UI" assembly="Microsoft.Web.Atlas" tagPrefix="atlas"/>
        <add namespace="Microsoft.Web.UI.Controls" assembly="Microsoft.Web.Atlas" tagPrefix="atlas"/>
      </controls>
    </pages>

    <compilation debug="false">
      <buildProviders>
          <add extension=".asbx" type="Microsoft.Web.Services.BridgeBuildProvider" />
      </buildProviders>
    </compilation>

    <httpHandlers>
      <remove verb="*" path="*.asmx"/>
      <add verb="*" path="*.asmx" type="Microsoft.Web.Services.ScriptHandlerFactory" validate="false"/>

      <add verb="*" path="atlasbatchcall.axd" type="Microsoft.Web.Services.MultiRequestHandler" validate="false"/>
      <add verb="*" path="atlasglob.axd" type="Microsoft.Web.Globalization.GlobalizationHandler" validate="false"/>

      <add verb="*" path="*.asbx" type="Microsoft.Web.Services.ScriptHandlerFactory" validate="false"/>
    </httpHandlers>
    <httpModules>
      <add name="ScriptModule" type="Microsoft.Web.Services.ScriptModule"/>
      <add name="BridgeModule" type="Microsoft.Web.Services.BridgeModule"/>
      <add name="WebResourceCompression" type="Microsoft.Web.Services.WebResourceCompressionModule"/>
    </httpModules>
 
  </system.web>
</configuration>

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值