Click here to Skip to main content
15,879,535 members
Articles / Web Development / ASP.NET

AJAX AutoCompleteExtender using Google Suggest API

Rate me:
Please Sign up or sign in to vote.
4.75/5 (12 votes)
10 Jul 2008CPOL1 min read 69.7K   1.3K   28  
Example on how to use AutoCompleteExtender to make a search like Google Suggest.
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default.aspx.cs" Inherits="_Default" %>
<%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="cc1" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title>Google Suggest Test</title>
</head>
<body>
    <form id="form1" runat="server">
        <asp:ScriptManager ID="ScriptManager1" runat="server">
        </asp:ScriptManager>
        <div>
            Google Suggest:
            <asp:TextBox ID="TextBox1" runat="server"></asp:TextBox>&nbsp;
            <asp:Button ID="Button1" runat="server" Text="Search" OnClick="Button1_Click" />
            <cc1:AutoCompleteExtender 
                ID="AutoCompleteExtender1" 
                runat="server" 
                Enabled="true" 
                MinimumPrefixLength="1" 
                TargetControlID="TextBox1" 
                ServicePath="google.asmx" 
                ServiceMethod="getList">
            </cc1:AutoCompleteExtender>
        </div>
    </form>
</body>
</html>

By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.

If a file you wish to view isn't highlighted, and is a text file (not binary), please let us know and we'll add colourisation support for it.

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)


Written By
Web Developer
India India
I am a web developer and working in an Indian Software company having lot of interest in ASP.NET, AJAX, C#. check out http://pabmohan.blogspot.com

Comments and Discussions