mary jean ligas

mary jean ligas

  • NA
  • 420
  • 196.8k

autocomplete extender does not work in master page

Feb 20 2013 10:58 PM
Hello Everyone, please help me on this..I need to implement a search text autocompletein my masterpage but it is not firing:

Here's my code:

CLIENT SIDE:

<asp:TextBox runat="server" ID="txtSearch" BorderStyle="None" CssClass="txtSearch" AutoPostBack="true"
  OnTextChanged="txtSearch_TextChanged">
 </asp:TextBox>
 
<asp:AutoCompleteExtender runat="server" ID="AutoCompleteExtender1" TargetControlID="txtSearch"
  ServiceMethod="GetSearchCat" EnableCaching="True" FirstRowSelected="True">
</asp:AutoCompleteExtender>


SERVER SIDE:


using System;
using System.Collections;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using System.Xml.Linq;
using CLMS.Connection.Linq;
using System.Collections.Generic;
using CLMS.Connection.temp;
using System.Web.Services;


namespace CLMS
{
  public partial class MasterPage : System.Web.UI.MasterPage
  {
  protected void Page_Load(object sender, EventArgs e)
  {
  if (!IsPostBack)
  {
  //SearchCategories();
  }
  }
  //------*FOR AUTOCOMPLETE*----------//
 
  [System.Web.Services.WebMethod]
  public static string[] GetSearchCat(string prefixText, int count)
  {
  CLMSDataContext context = new CLMSDataContext();
  string[] movies = { "Star Wars", "Star Trek", "Superman", "Memento", "Shrek", "Shrek II" };
  return (from m in movies where m.StartsWith(prefixText, StringComparison.CurrentCultureIgnoreCase) select m).Take(count).ToArray();

  //return context.Fact_Contracts.Where(n => n.ContractName.Contains(prefixText)).OrderBy(n => n.ContractName).Select(n => n.ContractName).Distinct().ToArray();
  //return context.sp_SearchContract(prefixText, Convert.ToInt64(HttpContext.Current.Session["User_Idx"])).Select(n => n.ContractName).Take(count).ToArray();

  }
  }
}



Anyone please help me..thank you so much...

Attachment: new folder 2.zip