Ajax Auto Complete Extender

Blog Author


Published Date

20th September, 2018




  • Share this blog :

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(); }

About Author


Author Bio

TekSlate is the best online training provider in delivering world-class IT skills to individuals and corporates from all parts of the globe. We are proven experts in accumulating every need of an IT skills upgrade aspirant and have delivered excellent services. We aim to bring you all the essentials to learn and master new technologies in the market with our articles, blogs, and videos. Build your career success with us, enhancing most in-demand skills .

Related Blogs

Write For Us