Click here to Skip to main content
15,892,809 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi,

my auto complete is not firng that with out using web service
Aspx:
ASP.NET
<asp:TextBox ID="txtRegistrationNo" runat="server" MaxLength="13" CssClass="textfield" AutoPostBack="true">
                                                    <asp:AutoCompleteExtender ID="TextBox1_AutoCompleteExtender" runat="server" DelimiterCharacters="" Enabled="True" ServiceMethod="GetAutoCompleteData" MinimumPrefixLength="1" EnableCaching="true" TargetControlID="txtRegistrationNo">


codebehind
C#
[System.Web.Script.Services.ScriptMethod()]
[System.Web.Services.WebMethod]
public static List<string> GetAutoCompleteData(string prefixname)
{
    List<string> result = new List<string>();
    List<e_location_master> locationmaster = (List<e_location_master>)locationlist;
    locationmaster = locationmaster.Where(P => P.STATE.ToLower().Contains(prefixname.ToLower()) || P.STATE.ToLower().Contains(prefixname.ToLower())).ToList();
    result = locationmaster.Select(P => P.STATE).Take(10).ToList();
    
    return result;
}
Posted
v3
Comments
Do you have a ScriptManager defined on aspx page?

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
Top Experts
Last 24hrsThis month


CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900