Wednesday, March 21, 2012

CascadingDropDown Method Error 500 ?

Hello!
I looked through lots of solutions to this problem on this forum but nothing helps - I still get Method Error 500 in drop down list.
Here's the code I use:

LocationService.asmx
----------

[WebService(Namespace =http://www.lgcon.ca/)]
[WebServiceBinding(ConformsTo =WsiProfiles.BasicProfile1_1)]
publicclassServiceLocation : System.Web.Services.WebService
{

[WebMethod]
[System.Web.Script.Services.ScriptMethod]
publicCascadingDropDownNameValue[] GetCountry(string knownCategoryValues,string category)
{
List<CascadingDropDownNameValue> values =newList<CascadingDropDownNameValue>();

values.Add(newCascadingDropDownNameValue("one","one"));
values.Add(newCascadingDropDownNameValue("two","two",true));

return values.ToArray();
}

}

ASPX page:
------
<asp:DropDownListID="ddlCountry"runat="server"/>
<cc1:CascadingDropDownID="cddCountry"runat="server"TargetControlID="ddlCountry"Category="Country"PromptText="Select a country"ServicePath="~/modules/location/ServiceLocation.asmx"ServiceMethod="GetCountry"/>

What am I doing wrong?

Thanks for help!

ok nevermind .. got it working .. just had to add "[System.Web.Script.Services.ScriptService]" before class declaration :)

No comments:

Post a Comment