ASP.NET AJAX Beta 1 and AutoCompleteExtender

Last post 11-02-2006 10:27 AM by Luis Abreu. 15 replies.

Sort Posts:

  • ASP.NET AJAX Beta 1 and AutoCompleteExtender

    10-24-2006, 4:26 PM
    • Member
      73 point Member
    • mogadanez
    • Member since 09-22-2005, 9:33 AM
    • Posts 48
     Have follow page:
    1    <%@ Register TagPrefix="ajaxPreview" Namespace="Microsoft.Web.Preview.UI.Controls" Assembly="Microsoft.Web.Preview" %>
    2    
    3    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
    4    
    5    <html xmlns="http://www.w3.org/1999/xhtml" >
    6    <head id="Head1" runat="server">
    7    <title>test autocomlete</title>
    8    </head>
    9    <body>
    10       <script language="javascript">
    11       function onClick()
    12       {    
    13       SearchService.GetAutoCompleteList("a",10, function(a1){alert(a1);} );
    14       }
    15       
    16       
    17       </script>
    18       <form id="form1" runat="server" defaultfocus="UserNameTextBox">
    19           <asp:ScriptManager ID="MainScriptManager" runat="server" >     
    20               <Services>
    21                   <asp:ServiceReference Path="~/Services/SearchService.asmx"  />
    22               </Services>
    23           </asp:ScriptManager>
    24           
    25           <input type="button" id="btn" value="custom call" onclick="onClick();" />
    26           <asp:TextBox ID="tbSearch" runat="server" /><br /><br />
    27           
    28           <ajaxPreview:AutoCompleteExtender ID="extSearchAutoCompleteExtender" runat="server" 
    29               MinimumPrefixLength="1" Visible="true"
    30               ServicePath="~/Services/SearchService.asmx" 
    31               ServiceMethod="GetAutoCompleteList" 
    32               TargetControlID="tbSearch"  />
    33       </form>
    34   </body>
    35   </html>
    36    
    

    and service:  

    [WebService]
    [ScriptService] 
    public class SearchService : WebService {
    
        [WebMethod]
        [ScriptMethod(true)]
        public string[] GetAutoCompleteList(string PrefixText, int count)
        {
           ...
        }    
    }

    When i press button - it works. But AutoCompleteExtender not work.
    I debug internal JS Code. it seems that Request to server was send in JSON format, but not parsed on server properly, and call not come to Service.
    I set breakpoint in service - it never come to it when use AutoCompleteExtender. But in Fiddler i can see that request goes to server.

    in Jule CTP same code was works fine.

    In anywherein  new documentation  has sample  with AutoCompleteExtender ? how use it in ASP.NET AJAX Beta 1

  • Re: ASP.NET AJAX Beta 1 and AutoCompleteExtender

    10-24-2006, 5:40 PM
    • All-Star
      25,662 point All-Star
    • Luis Abreu
    • Member since 02-12-2005, 1:22 AM
    • Madeira [Portugal]
    • Posts 5,368
    • TrustedFriends-MVPs

    hello.

    it seems like you're using get for the request. try removing true from the scriptmethod and see if it works. 

    --
    Regards,
    Luis Abreu
    email: labreu_at_gmail.com
    EN blog:http://msmvps.com/blogs/luisabreu
  • Re: ASP.NET AJAX Beta 1 and AutoCompleteExtender

    10-25-2006, 4:56 AM
    • Member
      73 point Member
    • mogadanez
    • Member since 09-22-2005, 9:33 AM
    • Posts 48

    Initialy it was without true, but not work too.

     I place true, when try to fix with. By Http Traces this flag not change anything.

    I'm found a problem, but not know how to fix it.

    when i call service with button follow package was send:  

    {"PrefixText":"a","count":10}
    but when i type "a" in text box: content will be follow:
    {"prefixText":"a","count":10}
     and response from server:
     
    "@_Error(false,"Invalid web service call, missing value for parameter: \'PrefixText\'.","   
       at Microsoft.Web.Script.Services.WebServiceMethodData.CallMethod(Object target, IDictionary`2 parameters)
       at Microsoft.Web.Script.Services.WebServiceMethodData.CallMethodFromRawParams(Object target, IDictionary`2 parameters)
       at Microsoft.Web.Script.Services.RestHandler.InvokeMethod(HttpContext context, WebServiceMethodData methodData, IDictionary`2 rawParams)
       at Microsoft.Web.Script.Services.RestHandler.ExecuteWebServiceCall(HttpContext context, WebServiceMethodData methodData)","System.InvalidOperationException")Error_@"
      
    Why in second case parametr prefixText starts with non Capital letter? 

     

  • Re: ASP.NET AJAX Beta 1 and AutoCompleteExtender

    10-25-2006, 5:14 AM
    • Member
      73 point Member
    • mogadanez
    • Member since 09-22-2005, 9:33 AM
    • Posts 48
    if I change Service Method signature form  
    public string[] GetAutoCompleteList(string PrefixText, int count)

     to

    public string[] GetAutoCompleteList(string prefixText, int count)
     AutoCompleteExtender works fine. But i have no clue why it works so.
  • Re: ASP.NET AJAX Beta 1 and AutoCompleteExtender

    10-25-2006, 3:45 PM
    • Member
      73 point Member
    • mogadanez
    • Member since 09-22-2005, 9:33 AM
    • Posts 48
    Can anyone explain why i need parametrs started from nonCapital letter?
  • Re: ASP.NET AJAX Beta 1 and AutoCompleteExtender

    10-25-2006, 4:03 PM
    • Star
      8,834 point Star
    • MorningZ
    • Member since 07-22-2002, 2:39 PM
    • Fort Lauderdale, FL
    • Posts 1,815

    First off... thanks for posting this (along with the solution) as i just ran into that error as well (Fiddler is so great for helping debug, eh) 

    Anyways, to maybe make an attempt at answering:

    mogadanez:
    Can anyone explain why i need parametrs started from nonCapital letter?

    Perhaps since the "closure" to "prototype" change that capitalization became important?   that's just a wild shot in the dark

    "If you make it idiot proof, they'll build a better idiot"
  • Re: ASP.NET AJAX Beta 1 and AutoCompleteExtender

    10-25-2006, 4:26 PM
    • Star
      8,834 point Star
    • MorningZ
    • Member since 07-22-2002, 2:39 PM
    • Fort Lauderdale, FL
    • Posts 1,815

    Just to backup my wild shot in the dark, using fiddler to poke around the javascript files spit out by the ScriptManager it has:

    Sys.Net._WebMethod._invoke(this, this._serviceMethod, this._serviceMethod, false,
                                            { prefixText : this._currentPrefix, count: this._completionSetCount },

    "If you make it idiot proof, they'll build a better idiot"
  • Re: ASP.NET AJAX Beta 1 and AutoCompleteExtender

    10-26-2006, 5:22 AM
    • Member
      73 point Member
    • mogadanez
    • Member since 09-22-2005, 9:33 AM
    • Posts 48

    when i call service method  "by hand"

    <script language="javascript">
    11       function onClick()
    12       {   
    13       SearchService.GetAutoCompleteList("a",10, function(a1){alert(a1);} );
    14       }
    15      
    16      
    17       </script>
    ...
    19           <asp:ScriptManager ID="MainScriptManager" runat="server" >    
    20               <Services>
    21                   <asp:ServiceReference Path="~/Services/SearchService.asmx"  />
    22               </Services>
    23           </asp:ScriptManager>

     

    it's work with any parametrs names "PrefixText", "prefixText", and "BLABLA"
    It is not work from AutoCompleteExtender ( and maybe from other components )

    and i have no idea why.

     

     

     

  • Re: ASP.NET AJAX Beta 1 and AutoCompleteExtender

    10-26-2006, 5:46 AM
    • All-Star
      25,662 point All-Star
    • Luis Abreu
    • Member since 02-12-2005, 1:22 AM
    • Madeira [Portugal]
    • Posts 5,368
    • TrustedFriends-MVPs

    hello.

    that's weird...i've just tested with a simple page and i've named the parameter PrefixText and it works without any problem... 

    --
    Regards,
    Luis Abreu
    email: labreu_at_gmail.com
    EN blog:http://msmvps.com/blogs/luisabreu
  • Re: ASP.NET AJAX Beta 1 and AutoCompleteExtender

    10-26-2006, 5:54 AM
    • Member
      73 point Member
    • mogadanez
    • Member since 09-22-2005, 9:33 AM
    • Posts 48
    in simple service call? or in AutoCompleteExtender?
  • Re: ASP.NET AJAX Beta 1 and AutoCompleteExtender

    10-26-2006, 2:13 PM
    • Member
      5 point Member
    • Sevnn
    • Member since 10-26-2006, 6:10 PM
    • Posts 1
    mogadanez:
    if I change Service Method signature form  
    public string[] GetAutoCompleteList(string PrefixText, int count)

     to

    public string[] GetAutoCompleteList(string prefixText, int count)

     AutoCompleteExtender works fine. But i have no clue why it works so.

    I had the exact same problem and was getting very frustrated by it.  This fixed my problem perfectly.  Thank you for posting this fix.

    Devteam, Can we get updated documentation showing these sorts of updates or atleast some form of example for the AutoCompleteExtender.

  • Re: ASP.NET AJAX Beta 1 and AutoCompleteExtender

    10-29-2006, 4:59 PM
    • Member
      68 point Member
    • denloof
    • Member since 10-29-2006, 1:31 AM
    • Posts 16

    Another big thanks here !!!

    I thought I was going nuts, how much can go wrong in configuring the autocomplete extender.

    changing PrefixText to prefixText was all it took.

    Kuddo's !

     

  • Re: ASP.NET AJAX Beta 1 and AutoCompleteExtender

    11-02-2006, 10:04 AM
    • Member
      102 point Member
    • brutter
    • Member since 11-25-2002, 12:52 PM
    • Posts 19
    This problem is true for VB.net also. Thanks for the help.
  • Re: ASP.NET AJAX Beta 1 and AutoCompleteExtender

    11-02-2006, 10:16 AM
    • All-Star
      25,662 point All-Star
    • Luis Abreu
    • Member since 02-12-2005, 1:22 AM
    • Madeira [Portugal]
    • Posts 5,368
    • TrustedFriends-MVPs
    hello guys. just like to confirm if this behavior happens when you use the internal server or only with iis. thanks.
    --
    Regards,
    Luis Abreu
    email: labreu_at_gmail.com
    EN blog:http://msmvps.com/blogs/luisabreu
  • Re: ASP.NET AJAX Beta 1 and AutoCompleteExtender

    11-02-2006, 10:18 AM
    • Member
      102 point Member
    • brutter
    • Member since 11-25-2002, 12:52 PM
    • Posts 19
    I am using Localhost with IIS
Page 1 of 2 (16 items) 1 2 Next >