Home Page
Articoli
Tips & Tricks
News
Forum
Archivio Forum
Blogs
Sondaggi
Rss
Video
Utenti
Chi Siamo
Contattaci
Username:
Password:
Login
Registrati ora!
Recupera Password
Home Page
Stanze Forum
ASP.NET 2.0 / 3.5 / 4.0
[ASP.net 2.0 + Ajax] AutoCompleteExtender
giovedì 20 novembre 2008 - 15.11
Elenco Threads
Stanze Forum
Aggiungi ai Preferiti
Cerca nel forum
narcofreccia
Profilo
| Newbie
1
messaggi | Data Invio:
gio 20 nov 2008 - 15:11
salve prima di tutto.
Sto effettuando delle prove per prendere un pò la mano con ajax e stavo appunto vedendo l'autocompleteextender. Sembra molto facile da utilizzare si indica su quale textbox deve lavorare. Si aggiunge al sito un Webservice che contenente una funzione che ritorna un array di stringhe...epuure non va
ecco il codice: (utilizzo microsoft visual studio 2005)
default.aspx
<%@ Page Language="VB" AutoEventWireup="true" CodeFile="Default.aspx.vb" Inherits="_Default" %>
<%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="cc1" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "
http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="
http://www.w3.org/1999/xhtml">
<head runat="server">
<title>Untitled Page</title>
</head>
<body>
<form id="form1" runat="server">
<asp:ScriptManager ID="ScriptManager1" runat="server">
<Services>
<asp:ServiceReference Path="WebService.asmx" />
</Services>
</asp:ScriptManager>
<div style="text-align: left">
<asp:TextBox ID="TextBox1" runat="server"></asp:TextBox>
<cc1:AutoCompleteExtender ID="AutoCompleteExtender1" runat="server"
ServiceMethod="GetCompletionList"
CompletionInterval="1000"
ServicePath="WebService.asmx"
ScriptPath="\App_code\Webservice.vb"
TargetControlID="TextBox1"
UseContextKey="True"
MinimumPrefixLength="3"
>
</cc1:AutoCompleteExtender>
</div>
</form>
</body>
</html>
webservice.asmx
<%@ WebService Language="VB" CodeBehind="~/App_Code/WebService.vb" Class="WebService" %>
App_code\webservice.vb
Imports System.Web
Imports System.Web.Services
Imports System.Web.Services.Protocols
Imports System.Collections.Generic
<WebService(Namespace:="
http://tempuri.org/"
)> _
<WebServiceBinding(ConformsTo:=WsiProfiles.BasicProfile1_1)> _
<Global.Microsoft.VisualBasic.CompilerServices.DesignerGenerated()> _
Public Class WebService
Inherits System.Web.Services.WebService
<WebMethod()> _
Public Function GetCompletionList(ByVal prefixText As String, ByVal count As Integer)
Dim items As New List(Of String)
items.Add(prefixText + "ciao")
Return items.ToArray()
End Function
End Class
grazie in anticipo per gli aiuti che verranno
Torna su
Stanze Forum
Elenco Threads
Partecipa anche tu! Registrati!
Hai bisogno di aiuto ?
Perchè non ti registri subito?
Dopo esserti registrato potrai chiedere
aiuto sul nostro
Forum
oppure aiutare gli altri
Consulta le
Stanze
disponibili.
Registrati ora !