关闭

atlas:AutoCompleteExtender Demo

标签: webserviceassemblyservercompilationstringpath
1101人阅读 评论(0) 收藏 举报
分类:
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>

0
0

查看评论
* 以上用户言论只代表其个人观点,不代表CSDN网站的观点或立场
    个人资料
    • 访问:119575次
    • 积分:1673
    • 等级:
    • 排名:千里之外
    • 原创:43篇
    • 转载:19篇
    • 译文:0篇
    • 评论:28条
    文章分类
    最新评论