Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / ASP.NET / General / March 2008

Tip: Looking for answers? Try searching our database.

Ajax what could be causing this?

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
mazdotnet - 18 Mar 2008 16:26 GMT
Hi,

I have setup the AjaxToolKit on my box which works great (cleaned up
their sample code for AutoCompleteExtender). However, when I import
the same code in my current project, it doesn't fire the webservice
that's suppose to return the auto complete results. What could be
causing this in my project? No compilation error, other AJAX
components work fine. Could be something in web.config file? I've
included my code below

<%@ Page Language="C#" AutoEventWireup="true"
CodeFile="Default.aspx.cs" Inherits="Test_Default" %>

<%@ Register assembly="AjaxControlToolkit"
namespace="AjaxControlToolkit" tagprefix="ajaxtoolkit" %>

<!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>Test</title>
</head>
<body>

   <form id="form1" runat="server">
      <ajaxToolkit:ToolkitScriptManager runat="server"
ID="ScriptManager1" />

          <asp:TextBox runat="server" ID="myTextBox" Width="300"
autocomplete="off" />
           <ajaxToolkit:AutoCompleteExtender
               runat="server"
               BehaviorID="AutoCompleteEx"
               ID="autoComplete1"
               TargetControlID="myTextBox"
               ServicePath="AutoComplete.asmx"
               ServiceMethod="GetCompletionList"
               MinimumPrefixLength="1"
               CompletionInterval="100"
               EnableCaching="true"
               CompletionSetCount="20"

CompletionListCssClass="autocomplete_completionListElement"
               CompletionListItemCssClass="autocomplete_listItem"

CompletionListHighlightedItemCssClass="autocomplete_highlightedListItem"
               DelimiterCharacters=";, :">
           </ajaxToolkit:AutoCompleteExtender>

   </form>
</body>
</html>

In my AutoComplete.asmx
<%@ WebService
   Language="C#"
   CodeBehind="/App_Code/AutoComplete.cs"
   Class="AutoComplete" %>

In App_Code folder AutoComplete.cs

using System;
using System.Collections.Generic;
using System.Web.Services;

[WebService(Namespace = "http://tempuri.org/")]
[WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)]
[System.Web.Script.Services.ScriptService]
public class AutoComplete : WebService
{
   public AutoComplete()
   {
   }

   [WebMethod]
   public string[] GetCompletionList(string prefixText, int count)
   {
       if (count == 0)
       {
           count = 10;
       }

       if (prefixText.Equals("xyz"))
       {
           return new string[0];
       }

       Random random = new Random();
       List<string> items = new List<string>(count);
       for (int i = 0; i < count; i++)
       {
           char c1 = (char)random.Next(65, 90);
           char c2 = (char)random.Next(97, 122);
           char c3 = (char)random.Next(97, 122);

           items.Add(prefixText + c1 + c2 + c3);
       }

       return items.ToArray();
   }
}

Thank you
Maz
Cowboy (Gregory A. Beamer) - 18 Mar 2008 17:04 GMT
Do you have all of the bits in the web.config file that would be there when
you created the "other" site? You might be missing a config element which
works with the Auto Complete Extender.

I have not personally played a lot with AJAX lately, but that is the first
thing that comes to mind.

Signature

Gregory A. Beamer
MVP, MCP: +I, SE, SD, DBA

Subscribe to my blog
http://gregorybeamer.spaces.live.com/lists/feed.rss

*************************************************

| Think outside the box!

*************************************************
> Hi,
>
[quoted text clipped - 101 lines]
> Thank you
> Maz
mazdotnet - 18 Mar 2008 17:34 GMT
On Mar 18, 12:04 pm, "Cowboy \(Gregory A. Beamer\)"
<NoSpamMgbwo...@comcast.netNoSpamM> wrote:
> Do you have all of the bits in the web.config file that would be there when
> you created the "other" site? You might be missing a config element which
[quoted text clipped - 119 lines]
>
> - Show quoted text -

Yes.. the 2 web.config files are extactly identical...

Any idea? anyone else?

Thx
Maz

Rate this thread:







Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.