• USA : +1 973 910 5725
  • INDIA: +91 905 291 3388
  • info@tekslate.com
  • Login

Ajax Auto Complete Extender

Auto Complete Extender

Auto complete Extender is generally used with a text box control to provide a list of values from a database or any other data source to provide a list of values just below the list box  so that user can select a value from the list. It has the following important properties.

target control ID

Service Method : Used to specify the method name that returns the list of values to display for that target control

Minimum prefix Length : Used to specify minimum number of characters to type within the target control to execute the service method and get list of values to display. 

Example

The following example demonstrates how to use auto complete extender control.

Add a page to the website and place a Toolkit script manger and a Label and text box and for the label set the caption employee name and for the Textbox set the ID T1.

Within HTML source of the page take one auto complete extender and set following properties for it.

<asp : Auto completeExtender ID = “AutoCompleteExtendr1” runat=”server” TargetControlID=”T1” MinumumprefixLength=”1” service Method=”GetNames”  Useconnect key=”True”> </asp:AutoCompleteExtender>

Within the design of that page click on the smart tag of text box control and choose “AutoCompleteMethod” to create the method “creatNames()” that is specified as service method for the autocomplete Extender and within that method write the following code.

Under GetName()

Sql connection Cn= new sqlconnection (“select Ename form Emp where Ename like” + prefixText+”%”,cn);

cn.open();

sqlDataReader Dr=cmd.ExecuteReader();

List<string> Names = new List <string > () ;

while(Dr.Read())

{

Names.Add(Dr[“Ename”].Tostring());

}

Dr.close();

cn.close();

return Names.ToArray();

}

Summary
Review Date
Reviewed Item
Ajax Auto Complete Extender
Author Rating
4

“At TekSlate, we are trying to create high quality tutorials and articles, if you think any information is incorrect or want to add anything to the article, please feel free to get in touch with us at info@tekslate.com, we will update the article in 24 hours.”

0 Responses on Ajax Auto Complete Extender"

    Leave a Message

    Your email address will not be published. Required fields are marked *

    Site Disclaimer, Copyright © 2016 - All Rights Reserved.

    Support


    Please leave a message and we'll get back to you soon.

    I agree to be contacted via e-mail.