Hello
my codes r below. but autocomplete doesnt be work. what can be problem ?
Thanks
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default.aspx.cs" Inherits="_Default" %><%@ Register assembly="AjaxControlToolkit" namespace="AjaxControlToolkit" tagprefix="asp" %><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head runat="server"><title></title><style type="text/css">
.style1 {
width: 1024px;
margin:0px auto;
}</style></head><body><form id="form1" runat="server"><div><asp:ToolkitScriptManager ID="ToolkitScriptManager1" runat="server"></asp:ToolkitScriptManager><table align="center" class="style1"style="border-spacing: 0px" ><tr><td align="center"><asp:TextBox ID="txtMovie" runat="server" Height="25px" Width="410px" ></asp:TextBox><asp:AutoCompleteExtender ID="txtMovie_AutoCompleteExtender" runat="server"
DelimiterCharacters=""
Enabled="True"
TargetControlID="txtMovie"
ServiceMethod="GetCompletionList"
ServicePath="AutoComplete.asmx"></asp:AutoCompleteExtender></td></tr><tr><td> </td></tr></table></div></form></body></html>using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
public partial class _Default : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
}
[System.Web.Services.WebMethodAttribute(), System.Web.Script.Services.ScriptMethodAttribute()]
public static string[] GetCompletionList(string prefixText, int count, string contextKey)
{
// Create array of movies
string[] movies = { "Star Wars", "Star Trek", "Superman", "Memento", "Shrek", "Shrek II" };
// Return matching movies
return (from m in movies where m.StartsWith(prefixText, StringComparison.CurrentCultureIgnoreCase) select m).Take(count).ToArray();
}
}