Click here to Skip to main content
15,881,852 members
Articles / Web Development / HTML

AJAX AutoComplete/AutoSuggest TextBox

Rate me:
Please Sign up or sign in to vote.
4.86/5 (51 votes)
2 Oct 20074 min read 879.8K   7K   147  
An article on AJAX AutoSuggest control
<%@ Page Language="C#" AutoEventWireup="true"  CodeFile="DataViewBinding.aspx.cs" Inherits="DataViewBinding" %>
<%@ Register Assembly="Anthem.AutoSuggest" Namespace="Anthem" TagPrefix="Anthem" %>
<%@ Register Assembly="Anthem" Namespace="Anthem" TagPrefix="Anthem" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<%@ Import Namespace="System.Data" %>
<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
    <title>AutoSuggestBox</title>
    <script language="javascript">
        
    </script>
</head>
<body>
    <form id="form1" runat="server">
    <div>        
        Type one or more letters into the textbox below.
        <br />
        <table border="1">
            <tr>
                <td>                    
                    Favorite Band:&nbsp;
                    <Anthem:AutoSuggestBox runat="server" ID="asbFavoriteBand" DataKeyField="BandID" TextBoxDisplayField="BandName"
                         AutoCallBack="true" ItemNotFoundMessage="Band not found!" Required="true" ErrorMessage="Required Field!" >
                         <ItemTemplate>
                            <i> <%# ((DataRowView)Container.DataItem)["BandName"] %> </i>
                         </ItemTemplate>
                    </Anthem:AutoSuggestBox>                            
                </td>
            </tr>
            <tr>
                <td>
                    <asp:dropdownlist runat="server" >
                        <asp:ListItem>Testing to see if the suggest list overlaps the dropdownlist</asp:ListItem>
                    </asp:dropdownlist>
                </td>
            </tr>
        </table>
         <asp:Panel BorderWidth="1px" runat="server">
          Testing to see if the suggest list moves the panel
         </asp:Panel>
        
              
        
        <br />
        <br />
        Selected ID:
        <Anthem:Label runat="server" ID="lblID" />
        <br />
        Selected Name:
        <Anthem:Label runat="server" ID="lblName" />
        
        <br /><br />
        <Anthem:Button runat="server" ID="btnValidate" Text="Validate" />
         <br />
        Is Valid:
        <Anthem:Label runat="server" ID="lblIsValid" />
    </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 has no explicit license attached to it but may contain usage terms in the article text or the download files themselves. If in doubt please contact the author via the discussion board below.

A list of licenses authors might use can be found here


Written By
Software Developer (Senior) Intelligent Coder
Canada Canada
I've been developing .NET enterprise applications since 2000.

I am originally from Rio de Janeiro and I am currently working at http://www.intelligentcoder.com in Ontario.

I also have my own startup where we offer client intake forms.

Comments and Discussions