Ok this is a really weird one. I am literally tearing my hair out. There is something really buggy with the Autocomplete Extender. I have the latest ajax build and control toolkit build.
I have a webpage that uses the autocomplete extender and it works fine. I wrote another page in the exact same directory, put just textbox and extender on the page, and put a simple return new string[] { "1", "2", "3" }; in the public static method and it doesn't work. It's so simple and it doesn't work. Let me show you the code. First of all, I stripped back the page that worked to its bare minimum:
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Copy of reporting.aspx.cs"
Inherits="code" %>
<!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 id="Head1" runat="server">
<title>Untitled Page</title>
</head>
<body>
<form id="form1" runat="server">
<div>
<ajax:ScriptManager ID="ScriptManager1" runat="server" />
<asp:TextBox runat="server" ID="tbSearchCategory" />
<ajaxToolkit:AutoCompleteExtender ID="AutoCompleteExtender1" ServiceMethod="getIt"
runat="server" TargetControlID="tbSearchCategory" />
</div>
</form>
</body>
</html>
using System;
using System.Data;
using System.Configuration;
using System.Collections;
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.Web.Script.Services;
using System.Web.Services;
public partial class code : System.Web.UI.Page
{
[WebMethod]
[ScriptMethod]
public static string[] getIt(string prefixText, int count)
{
return new string[] { "1", "2", "3"};
}
}
So this works fine. I re-typed the page into acetest.aspx and acetest.aspx.cs exactly, and it doesn't work!!! I even started copying bits and pieces from the page above to acetest.aspx and acetest.aspx.cs and it STILL doesn't work. Then I changed the codebehind in acetest to point to the file above, and that also doesn't work.
Then, I copied the text exactly from the aspx file above and pasted it into a new aspx file - acetest2.aspx - this works!!!
As you can see I'm REALLY going crazy here trying to work out what the problem is. All I can think of is that somehow something is getting cached - but I thought the EnableCaching was only to cache on that current page - if I close the browser and re-open it, it should have a clear cache, right?
Can someone please help me??