Bonsoir
Je voudrais juste ajouter une fonctionnalité Ajax à mes cascadedropdowmenu mais à chaque fois je reçois la même erreur quand je visualize la page.
En cherchant sur internet dans les forums de ASP.NET le seul problème qui s'opposait c'était l'absence de la balisequi existe déjà dans mon web service. En ce qui concerne les Datasets j'ai tout vérifier ça fonctionne, donc où est le problème.Code:<System.Web.Script.Services.ScriptService()> _
web service
Code:
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 Imports System.Web Imports System.Web.Services Imports System.Web.Services.Protocols Imports AjaxControlToolkit Imports System.Data Imports System.Data.SqlClient Imports System.Collections.Generic ' To allow this Web Service to be called from script, using ASP.NET AJAX, uncomment the following line. <WebService(Namespace:="http://tempuri.org/")> _ <WebServiceBinding(ConformsTo:=WsiProfiles.BasicProfile1_1)> _ <Global.Microsoft.VisualBasic.CompilerServices.DesignerGenerated()> _ <System.Web.Script.Services.ScriptService()> _ Public Class CityService Inherits System.Web.Services.WebService <WebMethod()> _ Public Function GetCities(ByVal knowncategorievalues As String, ByVal category As String) As CascadingDropDownNameValue() Dim cityAdapter As New dsCitiesTableAdapters.CitiesTableAdapter Dim makeValues As New List(Of CascadingDropDownNameValue)() For Each row As DataRow In cityAdapter.GetAllCities makeValues.Add(New CascadingDropDownNameValue(row("BranchID").ToString(), row("CityName").ToString(), row("BranchName").ToString())) Next Return makeValues.ToArray() End Function End Class
la page ASPX
Code:
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
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87 <%@ Page Language="VB" AutoEventWireup="false" CodeFile="Default.aspx.vb" Inherits="_Default" %> <%@ 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"> <html xmlns="http://www.w3.org/1999/xhtml"> <head runat="server"> <title></title> <style type="text/css"> .style1 { text-align: center; } .style2 { width: 46%; } .style4 { width: 250px; text-align: right; } .style5 { width: 1px; } </style> </head> <body> <form id="form1" runat="server"> <div class="style1"> <div> </div> <asp:ScriptManager ID="ScriptManager1" runat="server"> </asp:ScriptManager> <div class="style1"> <br /> <table class="style2"> <tr> <td class="style4"> <span lang="en-us">City:</span></td> <td class="style5"> </td> <td> <asp:DropDownList ID="CityDDL" runat="server" Height="16px" style="z-index: 1; margin-left: 0px" Width="146px"> </asp:DropDownList> </td> </tr> <tr> <td class="style4"> <span lang="en-us">Branch Name:</span></td> <td class="style5"> </td> <td> <asp:DropDownList ID="BranchNameDDL" runat="server" Height="16px" style="z-index: 1; margin-left: 0px" Width="146px"> </asp:DropDownList> </td> </tr> <tr> <td class="style4"> <span lang="en-us">Branch ID:</span></td> <td class="style5"> </td> <td> <asp:DropDownList ID="BranchIDDDL" runat="server" Height="16px" style="z-index: 1; margin-left: 0px" Width="146px"> </asp:DropDownList> </td> </tr> </table> <br /> <br /> <br /> </div> </div> <cc1:CascadingDropDown ID="CityCascadingDropDown" runat="server" TargetControlID ="CityDDL" Category ="City" PromptText ="Please Select Your City ..." LoadingText ="Retrieving Information" ServicePath ="CityService.asmx" ServiceMethod ="GetCities"> </cc1:CascadingDropDown> </form> </body> </html>
Merci :ccool: