dato il seguente web service:
e la pagina aspxcodice:Imports System.Web Imports System.Web.Services Imports System.Web.Services.Protocols Imports System.Data.OleDb Imports System.Data Imports AjaxControlToolkit Imports System.Collections.Generic ' To allow this Web Service to be called from script, using ASP.NET AJAX, uncomment the following line. ' <System.Web.Script.Services.ScriptService()> _ <WebService(Namespace:="http://tempuri.org/")> _ <WebServiceBinding(ConformsTo:=WsiProfiles.BasicProfile1_1)> _ <Global.Microsoft.VisualBasic.CompilerServices.DesignerGenerated()> _ Public Class WebService Inherits System.Web.Services.WebService Dim Conoledb As New OleDbConnection Public codProvincia As String Public provincia As String Public CodiceProvincia As String Public RcodRegione As Integer Public descRegione As String Public Function ListaProvince() As CascadingDropDownNameValue() Dim strConnection As String = ConfigurationManager.AppSettings("ConnectionSting").ToString Dim DT As New DataTable("Tabella") StrSql = "SELECT * FROM province WHERE 1=1 " If RcodRegione <> "" Then StrSql = StrSql & " AND RcodRegione=" & RcodRegione 'filtro per il tipo di cliente ricercato (per le liste) Dim DTA As New OleDbDataAdapter(StrSql, Conoledb) DTA.Fill(DT) DTA = Nothing Dim myPlayers As New List(Of CascadingDropDownNameValue) For i = 0 To DT.Rows.Count - 1 Dim strPlayerName As String = DT.Rows(i)("Provincia").ToString Dim strPlayerId As String = DT.Rows(i)("codProvincia").ToString myPlayers.Add(New CascadingDropDownNameValue(strPlayerName, strPlayerId)) Next Return myPlayers.ToArray End Function End Class
]codice:<asp:DropDownList ID="DropDownList1" runat="server" Width="182px"> </asp:DropDownList> <asp:DropDownList ID="DropDownList2" runat="server" Width="182px"> </asp:DropDownList> <ajaxToolkit:CascadingDropDown ID="CascadingDropDown2" runat="server" Category="province" PromptText="Select a manufacturer" ServicePath="WebService.asmx" ServiceMethod="ListaProvince" TargetControlID="DropDownList1" /> <ajaxToolkit:CascadingDropDown ID="ddlMake" ParentControlID="DropDownList1" runat="server" Category="province" PromptText="Select a manufacturer" ServicePath="WebService.asmx" ServiceMethod="ListaProvince" TargetControlID="DropDownList2"/>
ho seguito l'esempio da
http://programming.top54u.com/post/A...-Database.aspx
la prima dropdown mi compare a video, ma come primo elelemtno mi compare "error 500"
da cosa puo dipendere?, cosa ho sbagliato qui?
ho qualche dubbio su category, sarebbe il gat del dropdown...ma ho provato a mettere la tabella dove vado a selezionare..ma sempre lo stesso errore

Rispondi quotando