title: Autocomplete in sharepoint 2010 Visual webpart
body: <p>I am working on a Visual web part in which I need to list matching data when user type something in text box (like in Google search or Question Title in StackOverflow).</p>
  
  <p>I have ended up in lots of results, but it is for typical c# application.  I am looking for a solution which can be implemented directly in my visual web part.  I am using SharePoint 2010 and VS 2010.</p>
  
  <p>I did the following things</p>
  
  <p>Installed Ajax Control tool kit.
  Added the Items to VS toolbox
  and added the following code snippet.</p>
  
  <p>in .ascx file</p>
  
  <pre><code>&lt;%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="asp" %&gt;
  &lt;asp:ToolkitScriptManager ID="ToolkitScriptManager1" runat="server"&gt;&lt;/asp:ToolkitScriptManager&gt;
  &lt;asp:TextBox ID="txtMovie" runat="server"&gt;&lt;/asp:TextBox&gt;
  &lt;asp:AutoCompleteExtender 
      ID="AutoCompleteExtender1" 
      TargetControlID="txtMovie"  ServiceMethod="GetCompletionList"
      runat="server" UseContextKey="True" /&gt;
  </code></pre>
  
  <p>in .ascx.cs</p>
  
  <pre><code>[System.Web.Script.Services.ScriptMethod()]
  [System.Web.Services.WebMethod]      
  public static string GetCompletionList(string prefixText, int count, string contextKey)
  {           
      return "Hello";
  }
  </code></pre>
  
  <p>But when I deployed I am getting this error </p>
  
  <blockquote>
    <p>Only one instance of a ScriptManager can be added to the page.</p>
  </blockquote>
  
  <p>I removed the <code>&lt;asp:ToolkitScriptManager ID="ToolkitScriptManager1" runat="server"&gt;&lt;/asp:ToolkitScriptManager&gt;</code> from my .ascx file however after that I am not able to edit my sharepint pages because of some js error.</p>