Bonjour,
j'essaye simplement de mettre en place un cascadingdropdown en place, et invaraiblement j'ai toujours l'erreur 12031 au lieu de la liste de mes valeurs.
la strucutre de mon code est la suivante :
un page default.aspx comportant un script manager,
un usercontrol se trouvant dans le dossier UserControl qui contient le code suivant :
<asp:DropDownList ID="listCategorie" runat="server"></asp:DropDownList>
<cc1:CascadingDropDown ID="CascadingDropDownCategorie"
runat="server"
Category="Categorie"
PromptText="Choisir une catégorie"
ServiceMethod="getCategorie"
ServicePath="../WebServices/ws_realEstateType.asmx"
TargetControlID="listCategorie">
</cc1:CascadingDropDown>
</td>
<td>
<asp:Label ID="lblType" runat="server" Text="Type :" meta:resourcekey="lblType"></asp:Label></td><td>
<asp:DropDownList ID="listType" runat="server" ></asp:DropDownList>
<cc1:CascadingDropDown
ID="CascadingDropDownType"
runat="server"
Category="Type"
ParentControlID="listCategorie"
PromptText="Choisir un type..."
ServiceMethod="getType"
ServicePath="../WebServices/ws_realEstateType.asmx"
TargetControlID="listType">
</cc1:CascadingDropDown>
un webService se trouvant dans le dossier WebServices :
using System;
using System.Web;
using System.Collections;
using System.Web.Services;
using System.Web.Services.Protocols;
using AjaxControlToolkit;
using System.Collections.Generic;
using System.Collections.Specialized;
using SopraTools.DAL;
using System.Web.Script.Services;
using System.Windows.Forms;
/// <summary>
/// Summary description for ws_realEstateType
/// </summary>
[WebService(Namespace = "http://tempuri.org/")]
[WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)]
[System.Web.Script.Services.ScriptService()]
public class ws_realEstateType : System.Web.Services.WebService
{
public ws_realEstateType()
{
//Uncomment the following line if using designed components
//InitializeComponent();
}
[WebMethod]
[System.Web.Script.Services.ScriptMethod()]
public static CascadingDropDownNameValue[] getType(string knownCategoryValues, string category)
{
List<CascadingDropDownNameValue> dropDownType = new List<CascadingDropDownNameValue>();
try
{
dropDownType.Add(new CascadingDropDownNameValue("toto", "tata"));
dropDownType.Add(new CascadingDropDownNameValue("ttuu", "tiiti"));
return dropDownType.ToArray();
}
catch (Exception ex)
{
return null;
}
}
[WebMethod]
[System.Web.Script.Services.ScriptMethod()]
public static CascadingDropDownNameValue[] getCategorie(string knownCategoryValues, string category)
{
List<CascadingDropDownNameValue> dropDownType = new List<CascadingDropDownNameValue>();
try{
dropDownType.Add(new CascadingDropDownNameValue("coucou", "caucau"));
dropDownType.Add(new CascadingDropDownNameValue("coco", "tztz"));
return dropDownType.ToArray();
}
catch(Exception ex)
{
return null;
}
}
}
mon webservice est assez vide, mais c'est juste histoire de faire fonctionner le cascading dropdown .... J'ai éclusé pas mal de forum sans succès... Alors une idée ?
bonne journée.