PC Review


Reply
Thread Tools Rate Thread

Ajax what could be causing this?

 
 
mazdotnet
Guest
Posts: n/a
 
      18th Mar 2008
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

 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Radio Button Column In GridView Causing Postbacks In Ajax tristan_sehgal@yahoo.co.uk Microsoft ASP .NET 0 23rd Mar 2009 09:51 AM
Ajax what could be causing this? mazdotnet Microsoft ASP .NET 2 18th Mar 2008 04:34 PM
Ajax what could be causing this? help help :) mazdotnet Microsoft Dot NET 0 18th Mar 2008 03:38 PM
Deploying ASP.NET AJAX-Enabled Web site to host without AJAX insta =?Utf-8?B?QnJpYW4gRWR3YXJkcw==?= Microsoft ASP .NET 2 21st Feb 2007 10:22 PM
ajax postback causing Page reload after normal events life cycle =?Utf-8?B?TG91aXMtUGhpbGlwcGUgRHVtb3VsaW4=?= Microsoft ASP .NET 1 14th Mar 2006 01:32 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 06:00 AM.