Home  »  Code Snippets  »  AJAX  »

Ajax ListSearchExtender Control Sample

 Posted By : Soumya Ranjan SahooPosted Date : 19/11/2010 12:11:15 PM Category : AJAX Points : 4 (Rs 1.00)

ListSearchExtender Control is an Ajax control. It provides you the search option in DropDownList or ListBox by typing.

If you don't have Ajax Control Toolkit in your asp.net toolbox, then you can download  & use it.

Here is the example of ListSearchExtender in asp.net:

<%--Add a ListBox Control--%>

           <asp:ListBox ID="ListBox1" runat="server" Width="100px">
            <asp:ListItem>India</asp:ListItem>
<asp:ListItem>Australia</asp:ListItem>
<asp:ListItem>switzerland</asp:ListItem>
<asp:ListItem>USA</asp:ListItem>
<asp:ListItem>China</asp:ListItem>                            
<asp:ListItem>Brazil</asp:ListItem>
<asp:ListItem>Germany</asp:ListItem>
           </asp:ListBox>

<%--Add ListSearchExtender Control--%>
<%--Set TargetControlID Property to ListBox1 (Name of ListBox)--%>
           
          <cc1:ListSearchExtender ID="ListSearchExtender1" runat="server" TargetControlID="ListBox1" PromptText="Type to search">
            </cc1:ListSearchExtender>

<%--Add DropDownList Control--%>

          <asp:DropDownList ID="DropDownList2" runat="server" Width="100px">
            <asp:ListItem>India</asp:ListItem>
<asp:ListItem>Australia</asp:ListItem>
<asp:ListItem>switzerland</asp:ListItem>
<asp:ListItem>USA</asp:ListItem>
<asp:ListItem>China</asp:ListItem>                            
<asp:ListItem>Brazil</asp:ListItem>
<asp:ListItem>Germany</asp:ListItem>
          </asp:DropDownList>

<%--Add ListSearchExtender Control--%>
<%--Set TargetControlID Property to DropDownList1 (Name of DropDownlist)--%>

            <cc1:ListSearchExtender ID="ListSearchExtender2" runat="server" TargetControlID="DropDownList2" PromptText="Type to search">
            </cc1:ListSearchExtender>

 

Responses
No responses found for this thread. Be the first to respond this thread.
Post Reply
Login to post Response.