Ola pessoal.
Estou há 2 dias navegando, tentando achar solução pra esse problema e não consegui.
Tento implementar o componente AutoCompleteExtender mas ele não me retorna nada segue o cod abaixo:
<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="EfetuarVendas.aspx.cs" Inherits="Gerenciadore_de_Produtos.EfetuarVendas" %>
<%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="ajax" %>
<!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>Efetuar Vendas</title>
<link href="Estilo/Estilo.css" type="text/css" rel="Stylesheet" />
<script src="Jquery/jquery.js" type="text/javascript"></script>
<script src="scripts.js" type="text/javascript"></script>
</head>
<body class="filho">
<form id="form1" runat="server">
<ajax:ToolkitScriptManager runat="server" ID="script">
<Services>
<asp:ServiceReference Path="~/BuscaClientes.asmx" />
</Services>
</ajax:ToolkitScriptManager>
<div class="linha">
<span runat="server" id="silaba" style="color:#5961B4; font-family:Verdana; font-weight:bold; font-size:18px;">E</span>
<span runat="server" id="titulo" style=" font-family:Verdana; font-size:14px; margin-left:-2px">fetuar Vendas</span>
</div>
<div class="linha">
<asp:Label runat="server" ID="Label1" CssClass="texto item_c" Width="100px">Nome Cliente</asp:Label>
<asp:TextBox runat="server" autocomplete="off" ID="txtNome" CssClass="txt" MaxLength="50" Width="70px"></asp:TextBox>
<ajax:AutoCompleteExtender runat="server" ServicePath="BuscaClientes.asmx" EnableCaching="true"
ServiceMethod="Buscar" ID="aceNomes" MinimumPrefixLength="1" CompletionSetCount="5" TargetControlID="txtNome"></ajax:AutoCompleteExtender>
</div>
</form>
</body>
</html>
cod do WebService:
using System;
using System.Collections;
using System.ComponentModel;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.Services;
using System.Web.Services.Protocols;
using System.Xml.Linq;
namespace Gerenciadore_de_Produtos
{
/// <summary>
/// Summary description for BuscaClientes
/// </summary>
[WebService(Namespace = "http://tempuri.org/")]
[WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)]
[ToolboxItem(false)]
// To allow this Web Service to be called from script, using ASP.NET AJAX, uncomment the following line.
[System.Web.Script.Services.ScriptService]
public class BuscaClientes : System.Web.Services.WebService
{
public BuscaClientes()
{
}
[WebMethod]
[System.Web.Script.Services.ScriptMethod]
public string[] Buscar(string prefixo, int count)
{
string[] nomes = new string[50];
for (int i = 0; i < 50; i++)
{
nomes[i] = "Maria " + i.ToString();
}
return nomes;
}
}
}
Vlws!