Saturday, March 24, 2012

CascadingDropDownList Internal Error 500

Hi,

I am trying to use a CascadingDropDown list, the ParentDropDownList show up correctly, however, the Childdropdownlist give an error:

ChildDropDownList contains:
Prompt text
[Method error 500]

Here is the code I used:

<asp:ScriptManagerID="ScriptManager1"runat="server">

</asp:ScriptManager>

<br/>

<asp:DropDownListID="DropDownListLevel6xx"

runat="server"

DataSourceID="ods_Level6"

DataTextField="LEVEL6"

DataValueField="LEVEL6"Width="126px"

>

</asp:DropDownList>

<asp:DropDownListID="DropDownListLevel7xx"

runat="server"Width="153px"

>

</asp:DropDownList>

<br/>

<br/>

<br/>

<asp:ObjectDataSource

ID="ods_Level6"

OldValuesParameterFormatString="original_{0}"

SelectMethod="GetAllLevel6"

runat="server"

TypeName="DayOnePLCS.dsLevel67TableAdapters.Hierarchy_Level72TableAdapter"

></asp:ObjectDataSource>

<ajaxToolkit:CascadingDropDownID="CascadingDropDown1"runat="server"

Category="LEVEL7"LoadingText="Please wait..."ParentControlID="DropDownListLevel6xx"PromptText="Select a level 6 filter"

TargetControlID="DropDownListLevel7xx"ServicePath="Level67Service.asmx"

ServiceMethod="GetLevel7ByLevel6Id"/>

And the web service:

[WebService(Namespace ="http://tempuri.org/")]

[WebServiceBinding(ConformsTo =WsiProfiles.BasicProfile1_1)]

[ToolboxItem(false)]

publicclassLevel67Service : System.Web.Services.WebService {

[WebMethod]publicCascadingDropDownNameValue[] GetLevel7ByLevel6Id(string knownCategoryValues,string category) {

string[] _categoryValues = knownCategoryValues.Split(':',';');

String _level6 =Convert.ToString(_categoryValues[1]);

List<CascadingDropDownNameValue> _level7list =newList<CascadingDropDownNameValue>();

DayOnePLCS.dsLevel67TableAdapters.Hierarchy_Level71TableAdapter _level7Adapter =new DayOnePLCS.dsLevel67TableAdapters.Hierarchy_Level71TableAdapter();

foreach (DataRow _rowin _level7Adapter.GetLevel7byLevel6(_level6)) {

_level7list.Add(newCascadingDropDownNameValue(_row["LEVEL7"].ToString(), _row["LEVEL7"].ToString()));

}

return _level7list.ToArray();

}

}

I have tested the web service, it produce the right result.

Thanks in advance for any help!

Not sure if this will help, this is the web.config file..

Any help will be very much appreciated...

<?xml version="1.0"?>

<configuration>


<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>

<connectionStrings>

<REMOVED for sercurity reason>
</connectionStrings>

<system.web>
<!--
Set compilation debug="true" to insert debugging
symbols into the compiled page. Because this
affects performance, set this value to true only
during development.
-->
<compilation debug="true">
<assemblies>
<add assembly="System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"/>
<add assembly="System.Design, Version=2.0.0.0, Culture=neutral, PublicKeyToken=B03F5F7F11D50A3A"/>
<add assembly="System.Web.Extensions.Design, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
<add assembly="System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089"/></assemblies>
</compilation>
<!--
The <authentication> section enables configuration
of the security authentication mode used by
ASP.NET to identify an incoming user.
-->
<authentication mode="Windows" />
<!--
The <customErrors> section enables configuration
of what to do if/when an unhandled error occurs
during the execution of a request. Specifically,
it enables developers to configure html error pages
to be displayed in place of a error stack trace.

<customErrors mode="RemoteOnly" defaultRedirect="GenericErrorPage.htm">
<error statusCode="403" redirect="NoAccess.htm" />
<error statusCode="404" redirect="FileNotFound.htm" />
</customErrors>
-->
<globalization culture="en-GB"
fileEncoding="utf-8"
requestEncoding="utf-8"
responseEncoding="utf-8"/>


<pages>
<controls>
<add tagPrefix="asp" namespace="System.Web.UI" assembly="System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" />
</controls>
</pages>
<httpHandlers>
<remove verb="*" path="*.asmx"/>
<add verb="*" path="*.asmx" validate="false" type="System.Web.Script.Services.ScriptHandlerFactory, System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"/>
<add verb="*" path="*_AppService.axd" validate="false" type="System.Web.Script.Services.ScriptHandlerFactory, System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"/>
<add verb="GET,HEAD" path="ScriptResource.axd" type="System.Web.Handlers.ScriptResourceHandler, System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" validate="false"/>
</httpHandlers>
<httpModules>
<add name="ScriptModule" type="System.Web.Handlers.ScriptModule, System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"/>
</httpModules>
</system.web>

<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>


</configuration>


Hi,

Error with status code 500 indicates that there is a problem when theserver tries to process the request. There can be variant causes. Any exceptioncould be a candidate. So the problem is mainly about how to find out the realcause of the error. Here are several options:

1. Set a break point in the code that is responsible for process therequest, then debug through it to find out the exception being thrown;

2. The real error message is usually returned in the response. We can useHttp Sniffer (e.g., Fiddler) to peek into the traffic between the client andserver to find out the error message.

Then it won't betoo difficult to solve it after the cause is known.

No comments:

Post a Comment