Bonjour,
j'essaie d'utiliser l'autocompleteextender, mais je m'arrache les cheveux, je ne comprends pas ce qu'il ne fonctionne pas dans mon code, quelqu'un peut il m'aider ?
la page complete.aspx
la page AutoCompletion.asmx
Code : Sélectionner tout - Visualiser dans une fenêtre à part
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 <%@ Page Language="VB" %> <%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="cc1" %> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <script runat="server"> </script> <html xmlns="http://www.w3.org/1999/xhtml" > <head runat="server"> <title>Untitled Page</title> </head> <body> <form runat="server"> <div> <asp:ScriptManager ID="ScriptManager1" runat="server"> </asp:ScriptManager> <asp:TextBox ID="texte" runat="server" /> <cc1:AutoCompleteExtender id="AutoCompleteExtender1" runat="server" Enabled="True" ServicePath="AutoCompletion.asmx" ServiceMethod="GetAutoCompletion" MinimumPrefixLength="1" targetcontrolid="texte"> </cc1:AutoCompleteExtender> </div> </form> </body> </html>
Le code est tout simple, mais impossible de le faire fonctionner.
Code : Sélectionner tout - Visualiser dans une fenêtre à part
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 <%@ WebService Language="VB" Class="AutoCompletion" %> Imports System.Web Imports System.Web.Services Imports System.Web.Services.Protocols <WebService(Namespace:="http://microsoft.com/webservices/")> _ <WebServiceBinding(ConformsTo:=WsiProfiles.BasicProfile1_1)> _ Public Class AutoCompletion Inherits System.Web.Services.WebService <WebMethod()> _ Public Shared Function GetAutoCompletion(ByVal prefixText, ByVal count) As String() Dim valeurs(10) As String Dim listeFinal As String = String.Empty Dim result(10000) As String valeurs(0) = "Gaetan" valeurs(1) = "Filipe" valeurs(2) = "Nicko" valeurs(3) = "Yann" valeurs(4) = "Fabrice" valeurs(5) = "Fallout" valeurs(6) = "Frimeur" valeurs(7) = "Fafrjb" For Each valeur As String In valeurs If valeur.StartsWith(prefixText, StringComparison.OrdinalIgnoreCase) Then listeFinal += valeur & ";" End If Next result = listeFinal.Split(";") Array.Sort(result) GetAutoCompletion = result End Function End Class
Merci par avance
Partager