Windows Vista Forums
Vista Forums Home Join Vista Forums Windows 7 Forum Vista Tutorials Tags
Welcome to Windows Vista Forums. Our forum is dedicated to helping you find solutions with any problems, errors or issues you are experiencing with Windows Vista. The Vista forum also covers news and updates and has an extensive Windows Vista tutorial section that covers a wide range of tips and tricks.

Go Back   Vista Forums > Misc Newsgroups > .NET General

Vista Tutorial - Ajax what could be causing this?

Reply
 
Old 03-18-2008   #1 (permalink)
mazdotnet
Guest


 
 

Ajax what could be causing this?

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


My System SpecsSystem Spec
Reply

Thread Tools


Similar Threads
Thread Forum
AJAX widget security enabled Security News
.Net And Ajax .NET General
ASP.NET ajax client side framework failed to load .NET General
ajax in iis7.0 not work Vista General
Ajax what could be causing this? help help :) .NET General


Vista Forums is an independent web site and has not been authorized,
sponsored, or otherwise approved by Microsoft Corporation.
"Windows Vista", the Start Orb, and related materials are trademarks of Microsoft Corp.
© Designer Media Ltd

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46