ListSearchExtender Control

Posted by VIJI Sunday, July 5, 2009

In this Article we can see the usage of ListSearchExtender Control.

The control ListSearchExtender is a control available in AJAX Control Kit.

What is ListSearchExtender?

As the name indicates ,this control is used to extend the searchable features of web controls like DropdownList and ListBox in ASP.Net.

Usage of ListSearchExtender

The controls Dropdownlist and Listbox are used to list the various items collection.

If the number of items in the list box/Dropdownlist is more, we may want to highlight the items by typing the name of the few characters of the item.

This searchable feature in DropdownList and ListBox is accomplished with the help of ListSearchExtender.

Searchable Feature using JavaScript:

We can also Write JavaScript Code to Handle this.

And we have to Write Function FindItemInList()

But Without writing any code, we can achieve the searchable feature in Listbox and Dropdownlist.


* Ajax Control Toolkit

* Drag and Drop ListSearchExtender Control in the Page.

* Set the TargetControlID property of the ListSearchExtender to the name of ListBox or DropDownList.

* Remaining will be taken by ListSearchExtender Control



/* Add DropDownList Control */

< asp:DropDownList ID="DropDownList1" runat="server" >
< /asp:DropDownList >

/* Add ListSearchExtender Control */

/* Set TargetControlID Property to DropDownList1 (Name of DropDownlist) */

< cc1:ListSearchExtender ID="ListSearchExtender2" runat="server" TargetControlID="DropDownList1" >
< /cc1:ListSearchExtender >

/* Add ListBox Control */

< asp:ListBox ID="ListBox1" runat="server" >< /asp:ListBox >

/* Add ListSearchExtender Control */

/* Set TargetControlID Property to ListBox1 (Name of ListBox) */

< cc1:ListSearchExtender ID="ListSearchExtender1" runat="server" TargetControlID="ListBox1" >
< /cc1:ListSearchExtender >

/* Dropdownlist Population */

Public Sub PopulateDropDownList ()

'Populate Some items

DropDownList1.Items.Add ("Arabic")

DropDownList1.Items.Add ("English")

DropDownList1.Items.Add ("Tamil")

End Sub

/* ListBox Population */

Public Sub PopulateListBox ()

'Populate Some items

ListBox1.Items.Add ("Arabic")

ListBox1.Items.Add ("English")

ListBox1.Items.Add ("Tamil")

End Sub



1. No need to write code to handle searching

2. No Postback as it is based on AJAX concept.

3. Easy to use in pages

Just type in the listbox or dropdownlist the name of the item you want to search, it will highlight the items if it is available in the list

Same artcicle available under

0 Responses to ListSearchExtender Control

Post a Comment