want to load states according to selected country. data comes from database.
2 drop down boxes. drpCountry & drpState
specified corresponding web service methods for getting countries & states in atlas control - cascading drop down box
ran successfully without compilatn error. when selecting drpCountry drop down box, no values have been loaded instead errorr message [method error: 500]
Have you stepped through the code you posted with a debugger and made sure it's not throwing exceptions, etc.? If that's not it, my guess would be that you probably misconfigured your CascadingDropDownProperties. You might try making it work with one dropdown
first and then adding the second back by following the sample page.
Thanks,
Ted
This posting is provided "AS IS" with no warranties, and confers no rights.
I've got the same problem and I just can't figure out why its happening. I don't think there's anything special I need to set up in IIS. I just wish I knew what Method Error 500 meant! I can't seem to get any breakpoints to stop in the webservice when I'm
debugging so I don't know if it can't get there or if it does but I can't debug that way. Everything seems to compile just fine. My code is almost identical to yours. I've even tried not doing any database access and just hard coding some values into the List
and returning those but it won't even return that. Is there anyone out there that has an inkling of an idea of what I can look for? I'm running the project in IIS (not the VS webserver) as a website, the webservice is all in one page (code not split out) it's
in the same directory as the page I'm calling it from. I think I'm running IIS 5.1, would that be causing a problem? I'm fairly sure I've added all the right references to my web.config and bin directory. I just don't know what else to look for. please help!
okay so I decided to more closely compare my web.config with the one in the AtlasControlToolkit project and I found a few items that I didn't have that seemed like they would make a difference (for refernece, my project is being adapted to work with atlas,
I didn't create it from the start knowing I would work with Atlas). Those lines were:
I'm not really sure what these lines really accomplished but after I put them in my web.config in addition to some other stuff I had found on another page that was said I needed to run Atlas stuff I was able to successfully get my first dropdownlist to populate
with my data from my database. The problem now is that after I select something in the first dropdown, the second dropdown activates but I get the Method Error 500 again for that one instead of having it return my static values I put in the List object. If
I tell it to call the first method again, it'll populate just fine. I wonder if there's an additional parameter I'm missing.
muahahahhahah it's ALIVE! okay for the record incase anyone else is confused by this in the future "Method Error 500" is the web service's way of saying "I can't run this code for some reason" both my boxes would get the error if there was a global problem
to the service. To fix the "one has an error the other doesn't" thing, the first time was because I needed
<WebMethod()> _
before the second function I was calling (BTW this is VB, if you're doing it in C# there's a lot more reference for you guys out there). I guess that makes sense, but no one told me that. I figured it out on trial and error. And then since I couldn't debug
the service I had to slowly add in code one good line at a time until I was able to pinpoint each problem that caused the Method Error 500. One time it was trying to reference a column in a datatable that didn't exist, the other was using a variable that was
used in another method in the service (for some reason it didn't like that and I'm not sure why), another time it was declaring a variable and using it without initializing it. Another time it was accessing a session variable (btw to do that, just add EnableSession:=true
in that web method thing I just pasted above) when the session was nothing. And now the saga is over. Good luck to others with a similar error
BTW if someone knows a more efficient and less barbaric way to debug a webservice through VS 2005, please let me know!
Not sure if you found solution or what you perceive solution is really the one. Simple way to debug webservice is open asmx file and then debug. VS 2005 automatically debugs web service. I am in similar situation except I was able to debug Web service successfully,
but when I run aspx with cascaded dropdown I get this message "method Error 500" in dropdown.
CascadingDropDownAtlas Control ToolkitajaxAjaxControlToolkitASP.NET AJAX Control Toolkit troubleshootingASP.NET 2.0 Ajax Control Toolkit Ajax Tab Control
newbie .net
Member
20 Points
4 Posts
Error in cascading drop down box : method Error 500
Sep 25, 2006 11:42 AM|LINK
want to load states according to selected country. data comes from database.
2 drop down boxes. drpCountry & drpState
specified corresponding web service methods for getting countries & states in atlas control - cascading drop down box
ran successfully without compilatn error. when selecting drpCountry drop down box, no values have been loaded instead errorr message [method error: 500]
i have set page enble validatn to false.
--------------------------------------------------------
web service is as follows:
[WebMethod]
public CascadingDropDownNameValue[] GetCountries(string knownCategoryValues, string category)
{
List<CascadingDropDownNameValue> values = new List<CascadingDropDownNameValue>();
Database db = DatabaseFactory.CreateDatabase("ConnectionString");
DbCommand dbCommand = db.GetStoredProcCommand("sp_GetCountries");
// sql procedures sp_GetCountries returns all country code & country names
using (IDataReader dataReader = db.ExecuteReader(dbCommand))
{
while (dataReader.Read())
{
values.Add(new CascadingDropDownNameValue(dataReader.GetString(0), // for country code
dataReader.GetString(1))); // for country name
}
}
return values.ToArray();
}
[WebMethod]
public CascadingDropDownNameValue[] GetStatesForCountry(string knownCategoryValues, string category)
{
StringDictionary kv = CascadingDropDown.ParseKnownCategoryValuesString(knownCategoryValues);
int code;
if (!kv.ContainsKey("StateName") || !Int32.TryParse(kv["State"], out code))
{
return null;
}
List<CascadingDropDownNameValue> values = new List<CascadingDropDownNameValue>();
Database db = DatabaseFactory.CreateDatabase("ConnectionString");
DbCommand dbCommand = db.GetStoredProcCommand("sp_GetStates");
// sql procedure sp_getStates takes in the country code as parameter and returns corresponding state code & state names.
using (IDataReader dataReader = db.ExecuteReader(dbCommand))
{
while (dataReader.Read())
{
values.Add(new CascadingDropDownNameValue( dataReader.GetString(0), //for state code
dataReader.GetString(1))); // for state name
}
}
return values.ToArray();
}
--------------------------------------------------------------------------
Ted Glaza [M...
Contributor
4198 Points
847 Posts
AspNetTeam
Re: Error in cascading drop down box : method Error 500
Sep 26, 2006 09:18 PM|LINK
Have you stepped through the code you posted with a debugger and made sure it's not throwing exceptions, etc.? If that's not it, my guess would be that you probably misconfigured your CascadingDropDownProperties. You might try making it work with one dropdown first and then adding the second back by following the sample page.
Thanks,
Ted
Cattrah
Member
401 Points
102 Posts
Re: Error in cascading drop down box : method Error 500
Sep 27, 2006 05:56 PM|LINK
I've got the same problem and I just can't figure out why its happening. I don't think there's anything special I need to set up in IIS. I just wish I knew what Method Error 500 meant! I can't seem to get any breakpoints to stop in the webservice when I'm debugging so I don't know if it can't get there or if it does but I can't debug that way. Everything seems to compile just fine. My code is almost identical to yours. I've even tried not doing any database access and just hard coding some values into the List and returning those but it won't even return that. Is there anyone out there that has an inkling of an idea of what I can look for? I'm running the project in IIS (not the VS webserver) as a website, the webservice is all in one page (code not split out) it's in the same directory as the page I'm calling it from. I think I'm running IIS 5.1, would that be causing a problem? I'm fairly sure I've added all the right references to my web.config and bin directory. I just don't know what else to look for. please help!
~Cattrah~
Cattrah
Member
401 Points
102 Posts
Re: Error in cascading drop down box : method Error 500
Sep 27, 2006 06:38 PM|LINK
okay so I decided to more closely compare my web.config with the one in the AtlasControlToolkit project and I found a few items that I didn't have that seemed like they would make a difference (for refernece, my project is being adapted to work with atlas, I didn't create it from the start knowing I would work with Atlas). Those lines were:
<code>
<sectionGroup name="microsoft.web" type="Microsoft.Web.Configuration.MicrosoftWebSectionGroup">
<section name="webServices" type="Microsoft.Web.Configuration.WebServicesSection" requirePermission="false"/>
</sectionGroup>
<microsoft.web>
webServices enableBrowserAccess="true"/>
</microsoft.web>
I'm not really sure what these lines really accomplished but after I put them in my web.config in addition to some other stuff I had found on another page that was said I needed to run Atlas stuff I was able to successfully get my first dropdownlist to populate with my data from my database. The problem now is that after I select something in the first dropdown, the second dropdown activates but I get the Method Error 500 again for that one instead of having it return my static values I put in the List object. If I tell it to call the first method again, it'll populate just fine. I wonder if there's an additional parameter I'm missing.Cattrah
Member
401 Points
102 Posts
Re: Error in cascading drop down box : method Error 500
Sep 27, 2006 07:37 PM|LINK
muahahahhahah it's ALIVE! okay for the record incase anyone else is confused by this in the future "Method Error 500" is the web service's way of saying "I can't run this code for some reason" both my boxes would get the error if there was a global problem to the service. To fix the "one has an error the other doesn't" thing, the first time was because I needed
<WebMethod()> _
before the second function I was calling (BTW this is VB, if you're doing it in C# there's a lot more reference for you guys out there). I guess that makes sense, but no one told me that. I figured it out on trial and error. And then since I couldn't debug the service I had to slowly add in code one good line at a time until I was able to pinpoint each problem that caused the Method Error 500. One time it was trying to reference a column in a datatable that didn't exist, the other was using a variable that was used in another method in the service (for some reason it didn't like that and I'm not sure why), another time it was declaring a variable and using it without initializing it. Another time it was accessing a session variable (btw to do that, just add EnableSession:=true in that web method thing I just pasted above) when the session was nothing. And now the saga is over. Good luck to others with a similar error
BTW if someone knows a more efficient and less barbaric way to debug a webservice through VS 2005, please let me know!
dotnstuff
Member
23 Points
17 Posts
Re: Error in cascading drop down box : method Error 500
Jan 08, 2007 04:07 PM|LINK
Not sure if you found solution or what you perceive solution is really the one. Simple way to debug webservice is open asmx file and then debug. VS 2005 automatically debugs web service. I am in similar situation except I was able to debug Web service successfully, but when I run aspx with cascaded dropdown I get this message "method Error 500" in dropdown.
Let me know if anyone knows real solution.
dotnstuff
Member
23 Points
17 Posts
Re: Error in cascading drop down box : method Error 500
Jan 08, 2007 08:05 PM|LINK
I missed one line.
[
WebService(Namespace = "http://tempuri.org/")][
WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)][System.Web.Script.Services.
ScriptService()]public
class PCService : System.Web.Services.WebService {}
All the best.
AZuckerman
Member
2 Points
1 Post
Re: Error in cascading drop down box : method Error 500
Feb 12, 2007 03:06 PM|LINK
You will need to add all of the following sections to your web config to make both AJAX and web services run on an existing project:
<configSections> <sectionGroup name="system.web.extensions" type="System.Web.Configuration.SystemWebExtensionsSectionGroup, System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"> <sectionGroup name="scripting" type="System.Web.Configuration.ScriptingSectionGroup, System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"> <section name="scriptResourceHandler" type="System.Web.Configuration.ScriptingScriptResourceHandlerSection, System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" requirePermission="false" allowDefinition="MachineToApplication"/> <sectionGroup name="webServices" type="System.Web.Configuration.ScriptingWebServicesSectionGroup, System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"> <section name="jsonSerialization" type="System.Web.Configuration.ScriptingJsonSerializationSection, System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" requirePermission="false" allowDefinition="Everywhere"/> <section name="profileService" type="System.Web.Configuration.ScriptingProfileServiceSection, System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" requirePermission="false" allowDefinition="MachineToApplication"/> <section name="authenticationService" type="System.Web.Configuration.ScriptingAuthenticationServiceSection, System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" requirePermission="false" allowDefinition="MachineToApplication"/> </sectionGroup> </sectionGroup> </sectionGroup> </configSections>AdamCascadingDropDown Atlas Control Toolkit ajax AjaxControlToolkit ASP.NET AJAX Control Toolkit troubleshooting ASP.NET 2.0 Ajax Control Toolkit Ajax Tab Control
vishnubobade
Member
22 Points
12 Posts
Re: Error in cascading drop down box : method Error 500
May 07, 2007 12:41 PM|LINK
You will need to add all of the following sections to your web config to make both AJAX and web services run on an existing project:
<
system.webServer><
validation validateIntegratedModeConfiguration="false"/><
modules><
add name="ScriptModule" preCondition="integratedMode" type="System.Web.Handlers.ScriptModule, System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"/></
modules><
handlers><
remove name="WebServiceHandlerFactory-Integrated" /><
add name="ScriptHandlerFactory" verb="*" path="*.asmx" preCondition="integratedMode" type="System.Web.Script.Services.ScriptHandlerFactory, System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"/><
add name="ScriptHandlerFactoryAppServices" verb="*" path="*_AppService.axd" preCondition="integratedMode" type="System.Web.Script.Services.ScriptHandlerFactory, System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"/><
add name="ScriptResource" preCondition="integratedMode" verb="GET,HEAD" path="ScriptResource.axd" type="System.Web.Handlers.ScriptResourceHandler, System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" /></
handlers></
system.webServer>i have try it its work funtastic......
hope this will help you.
vishnu
AngelaG
Member
6 Points
3 Posts
Re: Error in cascading drop down box : method Error 500
Aug 29, 2007 10:37 AM|LINK
i have got all that in the web config, but I still get the same [Method error 500]... :-(