Ajax what could be causing this?
- From: mazdotnet <maflatoun@xxxxxxxxx>
- Date: Tue, 18 Mar 2008 08:26:57 -0700 (PDT)
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
.
- Follow-Ups:
- Re: Ajax what could be causing this?
- From: Cowboy \(Gregory A. Beamer\)
- Re: Ajax what could be causing this?
- Prev by Date: Very Slow VSS Development
- Next by Date: RE: Breakpoint in jscript not being hit - answer but no solution
- Previous by thread: Very Slow VSS Development
- Next by thread: Re: Ajax what could be causing this?
- Index(es):
Relevant Pages
|
Loading