Click here to Skip to main content
Click here to Skip to main content
Articles » Web Development » Ajax » Controls » Downloads
 
Add your own
alternative version
Go to top

AJAX AutoComplete/AutoSuggest TextBox

, 2 Oct 2007
An article on AJAX AutoSuggest control
autosuggestbox.zip
AutoSuggestBox
AutoSuggestBox
AutoSuggest
AutoSuggest.suo
AutoSuggest
Anthem.AutoSuggest.csproj.user
bin
Debug
Anthem.AutoSuggest.dll
Anthem.dll
Release
Anthem.AutoSuggest.dll
Anthem.AutoSuggest.pdb
Anthem.dll
Anthem.pdb
includes
vssver2.scc
Properties
Example
App_Code
App_Data
Bin
Anthem.AutoSuggest.dll
Anthem.AutoSuggest.pdb
Anthem.dll
Anthem.pdb
example.zip
Example
App_Code
App_Data
sample.zip
Bin
Anthem.AutoSuggest.dll
Anthem.AutoSuggest.pdb
Anthem.dll
Anthem.pdb
sourcefiles.zip
AutoSuggest
Anthem.AutoSuggest.csproj.user
bin
Debug
Anthem.AutoSuggest.dll
Anthem.dll
includes
vssver2.scc
Properties
using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;

public partial class ChildPage : System.Web.UI.Page
{
	protected void Page_Load(object sender, EventArgs e)
	{
		Anthem.Manager.Register(this);
	}

	protected override void OnInit(EventArgs e)
	{
		base.OnInit(e);
		this.asbProduct.TextChanged += new Anthem.AutoSuggestBox.TextChangedEventHandler(asbProduct_TextChanged);
		btnPost.Click += new EventHandler(btnPost_Click);
		asbProduct.ItemDataBound += new Anthem.AutoSuggestBox.ItemDataBoundHandler(asbProduct_ItemDataBound);
	}

	void asbProduct_ItemDataBound(object source, Anthem.AutoSuggestItemEventArgs e)
	{
		if (e.Item.ItemType == Anthem.AutoSuggestItemType.AlternatingItem)
		{
			HtmlTableCell cell = (HtmlTableCell)e.Item.FindControl("tcItem");			
			cell.BgColor = "#ECEDED";
		}
		else if (e.Item.ItemType == Anthem.AutoSuggestItemType.Header)
		{
			Label label = (Label)e.Item.FindControl("lblTest");
			label.Text = "Novo T�tulo";
		}
	}

	void btnPost_Click(object sender, EventArgs e)
	{
		lblSelectedValue.Text = asbProduct.SelectedValue;
	}

	void asbProduct_TextChanged(object source, Anthem.AutoSuggestEventArgs e)
	{
		DataTable dt = new DataTable();
		dt.Columns.Add("Name");
		DataRow row = dt.NewRow();
		row["Name"] = "Cassio";
		dt.Rows.Add(row);

		row = dt.NewRow();
		row["Name"] = "Steve Vai";
		dt.Rows.Add(row);

		row = dt.NewRow();
		row["Name"] = "Jonh";
		dt.Rows.Add(row);

		row = dt.NewRow();
		row["Name"] = "Daniel";
		dt.Rows.Add(row);

		row = dt.NewRow();
		row["Name"] = "Viviane";
		dt.Rows.Add(row);

		row = dt.NewRow();
		row["Name"] = "Bruno";
		dt.Rows.Add(row);

		row = dt.NewRow();
		row["Name"] = "Charles";
		dt.Rows.Add(row);

		row = dt.NewRow();
		row["Name"] = "Regina";
		dt.Rows.Add(row);

		DataView dv = new DataView(dt);
		asbProduct.DataSource = dv;
		asbProduct.DataBind();
	}
}

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

Share

About the Author

Cassio Mosqueira
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.

| Advertise | Privacy | Mobile
Web03 | 2.8.140905.1 | Last Updated 2 Oct 2007
Article Copyright 2007 by Cassio Mosqueira
Everything else Copyright © CodeProject, 1999-2014
Terms of Service
Layout: fixed | fluid