Autocomplete Extender?? I'm going crazy!!

Last post 03-29-2007 8:55 AM by azammitt. 10 replies.

Sort Posts:

  • Autocomplete Extender?? I'm going crazy!!

    02-28-2007, 6:21 PM

    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??

  • Re: Autocomplete Extender?? I'm going crazy!!

    02-28-2007, 7:45 PM
    also - in the code i posted above, if i change the getIt method name to getIt2 (in both aspx and cs files) then it ALSO doesn't work..
  • Re: Autocomplete Extender?? I'm going crazy!!

    03-06-2007, 12:19 AM
    anyone?? Crying
  • Re: Autocomplete Extender?? I'm going crazy!!

    03-06-2007, 1:34 AM
    • Participant
      1,386 point Participant
    • NNM
    • Member since 09-07-2006, 9:04 AM
    • Posts 540
    I think u need

    EnablePageMethods="true"in the scriptmanager tag to use pagemethods...
    Validation Complete
    ========== Build: 1 succeeded or up-to-date, 0 failed, 0 skipped ==========
    I'll always mark your post(s) as answer when it is!
  • Re: Autocomplete Extender?? I'm going crazy!!

    03-06-2007, 9:16 PM
    thankyou so much!!!! although i have no hair left now..
  • Re: Autocomplete Extender?? I'm going crazy!!

    03-06-2007, 10:05 PM

    hmmm... there's still something screwy going on.. not sure what exactly.... in case anyone else has this problem, here's what's happening:

    so i got the list to populate from a static string[] method on the page. then, i modified that method so that it just returned "1", "2", "3" ... and it still returned the old values! and get this - i completely removed the methods from the page, and it still populated the dropdownlist!!!! its obviously caching something... also note that this was done with 'enablecaching' set to false.

    the way i got it to 'resync' was to remove enablepagemethods and refresh, then add it again, and refresh. I'm assuming that this might be because the autocomplete extender automatically generates some sort of webservice and calls that? and that doesn't get updated automatically when the codebehind gets updated... this is very worrying because what if there are constant updates to the database that it gets the information for the dropdownlist from??

  • Re: Autocomplete Extender?? I'm going crazy!!

    03-06-2007, 10:12 PM

    why cant i just edit my posts?? anyway...

    i've solved the problem. its because the scriptmanager is in a master file.

    there obviously is some sort of caching going on, and it only updates the code thats called if the page with the scriptmanager is updated. so if i update the scriptmanager page, it then refreshes all the code. otherwise it keeps the cached version.

  • Re: Autocomplete Extender?? I'm going crazy!!

    03-28-2007, 3:24 PM
    • Member
      2 point Member
    • samheller
    • Member since 03-28-2007, 7:21 PM
    • Posts 7
    I just read your issues and I too was having similar issues but glad you confirmed that the script manager in the master page was your issue because that solved it for me. Thing is its far too late for me to alter the script manager out of the master page now for me. I need to leave it where it is and use some other method. Did you find one? Does the script proxy offer any help. Thanks
  • Re: Autocomplete Extender?? I'm going crazy!!

    03-28-2007, 4:31 PM
    • Member
      139 point Member
    • azammitt
    • Member since 03-15-2007, 8:38 AM
    • Posts 50

    I use autocomplete on a few pages of my application. My script manager is on the master page for all of them... it looks like this

     

                    <asp:ScriptManager ID="ScriptManager1" runat="server">
                    <Services>
                        <asp:ServiceReference Path="/RequestTracker/AutoComplete.asmx" />
                    </Services>
                    </asp:ScriptManager>
    Just change the Path= to the path of your web service.  I hope this helps
     
    -Alex
  • Re: Autocomplete Extender?? I'm going crazy!!

    03-28-2007, 7:16 PM

    hey azammitt

    that looks like a good answer! however my service is embedded in the aspx file (actually the aspx.cs file)... do you know if the servicereference works with those services? can i just point it to the aspx.cs file?

  • Re: Autocomplete Extender?? I'm going crazy!!

    03-29-2007, 8:55 AM
    • Member
      139 point Member
    • azammitt
    • Member since 03-15-2007, 8:38 AM
    • Posts 50

    benzo,

     I'm not sure if this will work with your embedded service.  If it does not work, you can always put your service in a .asmx file.  Sorry I can not be of more help

     

    -Alex

Page 1 of 1 (11 items)