Click here to Skip to main content
15,884,627 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Dear All,

I tried to create the Ajax Cascadedropdownlist. For that i created the Web service which contains 2 methods used to bind the data in the dropdownlist in my aspx page.

When I test the serveice, I'm getting the list of values list. But in the aspx page, the dropdownlist shows

[Method Error 12030]


Code Below :

In webservice.cs class

C#
[WebMethod]
   [System.Web.Script.Services.ScriptMethod]
   public CascadingDropDownNameValue[]  GetMakes(
     string knownCategoryValues,
     string category)
   {
     
       List<CascadingDropDownNameValue> values =
         new List<CascadingDropDownNameValue>();
       for (int i = 1; i <= 12; i++ )
       {
           string make = (i.ToString() ) ;
           int makeId = (int) i ;
           values.Add(new CascadingDropDownNameValue(
             make, makeId.ToString()));
       }
       return values.ToArray()  ;
   }


In aspx page :

VB
<ajaxToolkit:CascadingDropDown
ID="CascadingDropDown1"
runat="server"
TargetControlID="ddlMake"
Category="Make"
PromptText="Select a manufacturer"
ServicePath="CarsService.asmx"
ServiceMethod="GetCarMakes" />




Thanks
Sheik
Posted
Updated 19-Oct-11 1:12am
v2
Comments
uspatel 18-Oct-11 7:01am    
Share code
raj ch 19-Oct-11 2:02am    
post ur code

1 solution

Check your code

Add [System.Web.Script.Services.ScriptService()] before Class defination in Web Service.

Because the webservice is being called from java script, using ASP.NET AJAX, the enclosing class has to be decorated with the System.Web.Script.Services.ScriptService attibute to make it work.
 
Share this answer
 
Comments
shek124 19-Oct-11 1:01am    
Thanks.
I cannot able to add the System.Web.Script.Services.ScriptService attribute Because its showing error. However I have added the System.Web.Script.Services.ScriptMethod attribute. Still I' getting the error message in my dropdownlist
[Method Error 500]
[Method Error 12030]
Please help me that what is wrong here.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
Top Experts
Last 24hrsThis month


CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900