ASPForums.Net RSS Feedhttp://www.aspforums.net/Handlers/RSS.ashxLatest additions to the content that appears on ASPForums.Net(c) 2019 www.aspforums.com. All rights reserved.ASP.Net AJAX AutoCompleteExtender not working in Master Page<p>I am checking. I will get back to you soon.</p>https://www.aspforums.net:443/Threads/200998/ASPNet-AJAX-AutoCompleteExtender-not-working-in-Master-Page/https://www.aspforums.net:443/Threads/200998/ASPNet-AJAX-AutoCompleteExtender-not-working-in-Master-Page/Thu, 13 Dec 2018 22:52:46 GMTASP.Net AJAX AutoCompleteExtender not working in Master Page<p>Hi&nbsp;RaulSoni,</p> <p>I have kept one AjaxAutoCompleteExtender Html in Master Page and other in Content Page and WebMethod inside Content Page code file.</p> <p>Check this example. Now please take its reference and correct your code.</p> <p><strong><span style="text-decoration: underline;">Database</span></strong></p> <p>For this example I have used of Northwind database that you can download using the link given below.</p> <p><a href="https://www.aspsnippets.com/Articles/Install-Microsoft-Northwind-and-Pubs-Sample-databases-in-SQL-Server-Management-Studio.aspx">Download Northwind Database</a></p> <p><strong><span style="text-decoration: underline;">HTML</span></strong></p> <p><strong>Master Page</strong></p> <pre class="brush: html">&lt;html xmlns=&#34;http://www.w3.org/1999/xhtml&#34;&gt; &lt;head runat=&#34;server&#34;&gt; &lt;title&gt;&lt;/title&gt; &lt;asp:ContentPlaceHolder ID=&#34;head&#34; runat=&#34;server&#34;&gt; &lt;/asp:ContentPlaceHolder&gt; &lt;/head&gt; &lt;body&gt; &lt;form id=&#34;form1&#34; runat=&#34;server&#34;&gt; &lt;div&gt; &lt;asp:ScriptManager ID=&#34;ScriptManager1&#34; runat=&#34;server&#34; EnablePageMethods=&#34;true&#34;&gt; &lt;/asp:ScriptManager&gt; &lt;b&gt;Master Page AutoCompleteExtender&lt;/b&gt; &lt;asp:TextBox ID=&#34;txtEmployeeSearch&#34; runat=&#34;server&#34;&gt;&lt;/asp:TextBox&gt; &lt;cc1:AutoCompleteExtender ServiceMethod=&#34;SearchEmployees&#34; MinimumPrefixLength=&#34;1&#34; CompletionInterval=&#34;100&#34; EnableCaching=&#34;false&#34; CompletionSetCount=&#34;10&#34; TargetControlID=&#34;txtEmployeeSearch&#34; ID=&#34;AutoCompleteExtender1&#34; runat=&#34;server&#34; FirstRowSelected=&#34;true&#34;&gt; &lt;/cc1:AutoCompleteExtender&gt; &lt;hr /&gt; &lt;asp:ContentPlaceHolder ID=&#34;ContentPlaceHolder1&#34; runat=&#34;server&#34;&gt; &lt;/asp:ContentPlaceHolder&gt; &lt;/div&gt; &lt;/form&gt; &lt;/body&gt; &lt;/html&gt;</pre> <p><strong>Content Page</strong></p> <pre class="brush: html">&lt;asp:Content ID=&#34;Content1&#34; ContentPlaceHolderID=&#34;head&#34; runat=&#34;Server&#34;&gt; &lt;/asp:Content&gt; &lt;asp:Content ID=&#34;Content2&#34; ContentPlaceHolderID=&#34;ContentPlaceHolder1&#34; runat=&#34;Server&#34;&gt; &lt;b&gt;Content Page AutoCompleteExtender&lt;/b&gt; &lt;asp:TextBox ID=&#34;txtContactsSearch&#34; runat=&#34;server&#34;&gt;&lt;/asp:TextBox&gt; &lt;cc1:AutoCompleteExtender ServiceMethod=&#34;SearchCustomers&#34; MinimumPrefixLength=&#34;1&#34; CompletionInterval=&#34;100&#34; EnableCaching=&#34;false&#34; CompletionSetCount=&#34;10&#34; TargetControlID=&#34;txtContactsSearch&#34; ID=&#34;AutoCompleteExtender1&#34; runat=&#34;server&#34; FirstRowSelected=&#34;true&#34;&gt; &lt;/cc1:AutoCompleteExtender&gt; &lt;/asp:Content&gt; </pre> <p><strong><span style="text-decoration: underline;">Namespaces</span></strong></p> <p><strong>C#</strong></p> <pre class="brush: csharp">using System.Collections.Generic; using System.Configuration; using System.Data.SqlClient; using System.Web.Script.Services; using System.Web.Services;</pre> <p><strong>VB.Net</strong></p> <pre class="brush: vb">Imports System.Collections.Generic Imports System.Configuration Imports System.Data.SqlClient Imports System.Web.Script.Services Imports System.Web.Services</pre> <p><strong><span style="text-decoration: underline;">Code</span></strong></p> <p><strong>C#</strong></p> <pre class="brush: csharp">[ScriptMethod()] [WebMethod] public static List&lt;string&gt; SearchCustomers(string prefixText, int count) { using (SqlConnection conn = new SqlConnection()) { conn.ConnectionString = ConfigurationManager.ConnectionStrings[&#34;constr&#34;].ConnectionString; using (SqlCommand cmd = new SqlCommand()) { cmd.CommandText = &#34;select ContactName from Customers where ContactName like @SearchText + &#39;%&#39;&#34;; cmd.Parameters.AddWithValue(&#34;@SearchText&#34;, prefixText); cmd.Connection = conn; conn.Open(); List&lt;string&gt; customers = new List&lt;string&gt;(); using (SqlDataReader sdr = cmd.ExecuteReader()) { while (sdr.Read()) { customers.Add(sdr[&#34;ContactName&#34;].ToString()); } } conn.Close(); return customers; } } } [ScriptMethod()] [WebMethod] public static List&lt;string&gt; SearchEmployees(string prefixText, int count) { using (SqlConnection conn = new SqlConnection()) { conn.ConnectionString = ConfigurationManager.ConnectionStrings[&#34;constr&#34;].ConnectionString; using (SqlCommand cmd = new SqlCommand()) { cmd.CommandText = &#34;SELECT FirstName + &#39; &#39; + LastName Name FROM Employees WHERE FirstName like @SearchText + &#39;%&#39;&#34;; cmd.Parameters.AddWithValue(&#34;@SearchText&#34;, prefixText); cmd.Connection = conn; conn.Open(); List&lt;string&gt; customers = new List&lt;string&gt;(); using (SqlDataReader sdr = cmd.ExecuteReader()) { while (sdr.Read()) { customers.Add(sdr[&#34;Name&#34;].ToString()); } } conn.Close(); return customers; } } }</pre> <p><strong>VB.Net</strong></p> <pre class="brush: vb">&lt;ScriptMethod()&gt; &lt;WebMethod&gt; Public Shared Function SearchCustomers(ByVal prefixText As String, ByVal count As Integer) As List(Of String) Using conn As SqlConnection = New SqlConnection() conn.ConnectionString = ConfigurationManager.ConnectionStrings(&#34;constr&#34;).ConnectionString Using cmd As SqlCommand = New SqlCommand() cmd.CommandText = &#34;select ContactName from Customers where ContactName like @SearchText + &#39;%&#39;&#34; cmd.Parameters.AddWithValue(&#34;@SearchText&#34;, prefixText) cmd.Connection = conn conn.Open() Dim customers As List(Of String) = New List(Of String)() Using sdr As SqlDataReader = cmd.ExecuteReader() While sdr.Read() customers.Add(sdr(&#34;ContactName&#34;).ToString()) End While End Using conn.Close() Return customers End Using End Using End Function &lt;ScriptMethod()&gt; &lt;WebMethod&gt; Public Shared Function SearchEmployees(ByVal prefixText As String, ByVal count As Integer) As List(Of String) Using conn As SqlConnection = New SqlConnection() conn.ConnectionString = ConfigurationManager.ConnectionStrings(&#34;constr&#34;).ConnectionString Using cmd As SqlCommand = New SqlCommand() cmd.CommandText = &#34;SELECT FirstName + &#39; &#39; + LastName Name FROM Employees WHERE FirstName like @SearchText + &#39;%&#39;&#34; cmd.Parameters.AddWithValue(&#34;@SearchText&#34;, prefixText) cmd.Connection = conn conn.Open() Dim customers As List(Of String) = New List(Of String)() Using sdr As SqlDataReader = cmd.ExecuteReader() While sdr.Read() customers.Add(sdr(&#34;Name&#34;).ToString()) End While End Using conn.Close() Return customers End Using End Using End Function</pre> <p><strong><span style="text-decoration: underline;">Screenshot</span></strong></p> <p><strong><span style="text-decoration: underline;"><img src="https://i.imgur.com/zPlCzJk.gif" alt="" width="472" height="280" /></span></strong></p>https://www.aspforums.net:443/Threads/200998/ASPNet-AJAX-AutoCompleteExtender-not-working-in-Master-Page/https://www.aspforums.net:443/Threads/200998/ASPNet-AJAX-AutoCompleteExtender-not-working-in-Master-Page/Fri, 14 Dec 2018 00:22:47 GMTASP.Net AJAX AutoCompleteExtender not working in Master Page<p>&nbsp;</p> <p><span title="">Dharmendr</span><br /><span title="">HI</span><br /><br /><span title="">Thank you very much for your support</span><br /><span title="">I am already resolved.</span><br /><br /><span title="">Greetings.</span></p>https://www.aspforums.net:443/Threads/200998/ASPNet-AJAX-AutoCompleteExtender-not-working-in-Master-Page/https://www.aspforums.net:443/Threads/200998/ASPNet-AJAX-AutoCompleteExtender-not-working-in-Master-Page/Sat, 15 Dec 2018 13:57:54 GMTASP.Net AJAX AutoCompleteExtender not working in Master Page<p>As you have resolved please share the solution and mark that as answer.</p>https://www.aspforums.net:443/Threads/200998/ASPNet-AJAX-AutoCompleteExtender-not-working-in-Master-Page/https://www.aspforums.net:443/Threads/200998/ASPNet-AJAX-AutoCompleteExtender-not-working-in-Master-Page/Sun, 16 Dec 2018 22:37:11 GMT