...

View Full Version : [Method Error 500]



FabriceB
02-08-2011, 12:59 AM
Hi all!

I've been working on trying to get a page with cascading dropdowns to work. Right now the page loads but when i attempt to see what is in the first dropdown I get: [Method error 500]

The dropdown list is as follows:


<asp:ScriptManager ID="ScriptManager1" runat="server" />
Department:<asp:DropdownList id="DeptSelect" runat="server" Enabled="True"></asp:DropdownList><br/>
Manager:<asp:DropdownList id="MgrSelect" runat="server"></asp:DropdownList><br/>
Team Leader:<asp:DropdownList id="TlSelect" runat="server"></asp:DropdownList><br/>
CSR:<asp:DropdownList id="CsrSelect" runat="server"></asp:DropdownList><br/>
<cc1:CascadingDropDown ID="CascadingDropDown1" runat="server" TargetControlID="DeptSelect" Category="Department" PromptText="Select a Department" ServicePath="WebService/Hierarchy.asmx" ServiceMethod="GetDepartments" ></cc1:CascadingDropDown>
<cc1:CascadingDropDown ID="CascadingDropDown2" runat="server" TargetControlID="MgrSelect" ParentControlID="DeptSelect" Category="Manager" PromptText="Select a Manager" ServicePath="WebService/Hierarchy.asmx" ServiceMethod="GetManagers" LoadingText="Load Text...."></cc1:CascadingDropDown>
<cc1:CascadingDropDown ID="CascadingDropDown3" runat="server" TargetControlID="TlSelect" ParentControlID="MgrSelect" Category="TL" PromptText="Select a Team Leader" ServicePath="WebSerivce/Hierarchy.asmx" ServiceMethod="GetTL" LoadingText="Load Text...."></cc1:CascadingDropDown>
<cc1:CascadingDropDown ID="CascadingDropDown4" runat="server" TargetControlID="CsrSelect" ParentControlID="TlSelect" Category="csr" PromptText="Select a CSR" ServicePath="WebSerivce/Hierarchy.asmx" ServiceMethod="GetCSR" LoadingText="Load Text...."></cc1:CascadingDropDown>

on the top of my aspx page I have the following:<%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="cc1" %>

this is my asmx


<%@ WebService Language="VB" Class="Hierarchy" %>

Imports System.Web
Imports System.Web.Services
Imports System.Web.Services.Protocols
Imports System.Collections.Generic
Imports System.Data
Imports System.Data.SqlClient
Imports System.Web.Script.Services
Imports AjaxControlToolkit


<WebService(Namespace:="http://tempuri.org/")> _
<WebServiceBinding(ConformsTo:=WsiProfiles.BasicProfile1_1)> _
<Global.Microsoft.VisualBasic.CompilerServices.DesignerGenerated()> _
<System.Web.Script.Services.ScriptService()> _

Public Class Hierarchy
Inherits System.Web.Services.WebService

Protected WithEvents from_date As System.Web.UI.WebControls.TextBox
Protected WithEvents to_date As System.Web.UI.WebControls.TextBox

Public Sub New()

End Sub

<WebMethod()> _
Public Function GetDepartments(ByVal knownCategoryValues As String, ByVal category As String) As CascadingDropDownNameValue()
Dim strConnection As String = ConfigurationManager.ConnectionStrings("PROD").ConnectionString
Dim sqlConn As SqlConnection = New SqlConnection(strConnection)
Dim strQuery As String = "Prg_GetHierarchy '" & from_date.Text & "', '" & to_date.Text & "'"
Dim cmdFetchDept As SqlCommand = New SqlCommand(strQuery, sqlConn)

Dim dtrDept As SqlDataReader
Dim myDepartments As New List(Of CascadingDropDownNameValue)

sqlConn.Open()
dtrDept = cmdFetchDept.ExecuteReader

While dtrDept.Read()
Dim strDeptName As String = dtrDept("Dept_Desc").ToString
Dim strDeptId As String = dtrDept("Dept_ID").ToString

myDepartments.Add(New CascadingDropDownNameValue(strDeptName, strDeptId))
End While

Return myDepartments.ToArray
End Function

End Class


I've only posted the department method as in any case, without this one working, none of the others could ever really work.

I've googled the error and mainly found that people had their issue resolved by adding the following:


<System.Web.Script.Services.ScriptService()> _

I already had that so I moved on and found that sometimes it could be relative to the web.config file...

the reason why I think this may be where i'm going wrong is because EVERYTHING up until now on our server was on ASP... So i'm the first to play with converting to .NET

So far I've made some modifications but I have to admit that I am not 100% that I've done all that I should. That said, here is what I have as well:


<?xml version="1.0" encoding="utf-8"?>
<configuration>
<connectionStrings>
<add name="PROD" connectionString="File Name=C:\reporting_udl\web\accepted_www.udl;" />
</connectionStrings>

<system.web>
<compilation debug="true"/>
</system.web>

<system.data>
<DbProviderFactories>
<add name="SqlClient Data Provider" invariant="System.Data.SqlClient"
description=".Net Framework Data Provider for SqlServer"
type="System.Data.SqlClient.SqlClientFactory, System.Data,
Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
</DbProviderFactories>
</system.data>


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

Other details that may help:


I've written everything without the use of Visual Studio...
The files are located as follows:


Web.Config: D:\LOCALDEV\ (root)
AjaxToolkit: D:\LOCALDEV\BIN
Default.aspx: D:\LOCALDEV\reports\adjustment\Summary
Hierarchy.asmx: D:\LOCALDEV\reports\adjustment\Summary\WebService
The webservice on it's own works fine - Meaning if I open Hierarchy.asmx I get my methods listed.

If anyone can tell me where I'm going wrong it would be appreciated!

Thanks!



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum