Showing posts with label learn. Show all posts
Showing posts with label learn. Show all posts

Wednesday, March 21, 2012

CascadingDropDown method error 500

Hi,

I've created a new project following the video found here :http://www.asp.net/learn/ajax-videos/video-77.aspx

My code is the same as in the demo, but when I run the website, I have the "method error 500" in each dropdownlist instead of the makes, models and colors...

Does anyone know what this error code means ?

Thanks for your help.

Hi Dpin,

10.5 Server Error 5xx
Response status codes beginning with the digit "5" indicate cases in which the server is aware that it has erred or is incapable of performing the request. Except when responding to a HEAD request, the server should include an entity containing an explanation of the error situation, and whether it is a temporary or permanent condition. User agents should display any included entity to the user. These response codes are applicable to any request method.

10.5.1 500 Internal Server Error
The server encountered an unexpected condition which prevented it from fulfilling the request.

To resovle the kind of problem, we suggest that you should first check whether your WebService works fine or not. Then check the Control settings. If all these are ok, but your application doesn't work properly. Please add break points to your WebService and debug it step-by-step. Here is theuseful information. Please pay special attention to my last reply.

I hope this help.

Best regards,

Jonathan

CascadingDropDown Lists [Method Error 500]

Hi All,

I have recently started to learn AJAX, as well as all web developing. I am trying to read a database using a web service to populate drop down lists. I have searched through hundreds of posts and tried everything I found. The most common fix I found was to add System.Web.Script.Services.ScriptService before my class and System.Web.Script.Services.ScriptMethod before my WebMethod. I've tried upping my maxjsonlength. But these haven't fixed my problem. My problem being that on my development machine the app works fine, but on my webserver I get the Method Error 500. It seems like it can't find the asmx file, because, to see if it would even return anything, I took out the database read and put in bogus output.

Could my server be missing some key element to run AJAX? I have installed the Extentions on it. Is there something I have to do to deploy or publish the app? I have been just copying over all the files in my project.

I tried to put a call to the webservice in a page level method like they did on the How do I: cascading .. video, but that didn't work. I received a "BC30002: Type WebService not defined" Error. So that brings me back to thinking the app can't find the asmx file.

Anyone have any ideas?! Thanks for the help!

asmx file code:

Imports System.Web

Imports System.Web.Services

Imports System.Web.Services.Protocols

Imports AjaxControlToolkit

Imports System.Collections.Generic

Imports System.Data<WebService(Namespace:="http://tempuri.org/")> _

<WebServiceBinding(ConformsTo:=WsiProfiles.BasicProfile1_1)> _

<Global.Microsoft.VisualBasic.CompilerServices.DesignerGenerated()> _

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

PublicClass WebServiceInherits System.Web.Services.WebService

<WebMethod()> _

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

PublicFunction GetCategory(ByVal knownCategoryValuesAsString,ByVal categoryAsString)As CascadingDropDownNameValue()

Dim myListAsNew List(Of CascadingDropDownNameValue)

Dim adapterAsNew DataSet1TableAdapters.sp_GetCategory1TableAdapter

myList.Add(New CascadingDropDownNameValue("test","test"))

Return myList.ToArray

'For Each dr As DataRow In adapter.GetCategory1

' myList.Add(New CascadingDropDownNameValue(dr("Category1").ToString, dr("Category1").ToString))

'Next

'Return myList.ToArray

EndFunction

EndClass

aspx file code:

<%@dotnet.itags.org.PageLanguage="VB"AutoEventWireup="true"CodeFile="Default.aspx.vb"Inherits="_Default"EnableEventValidation="false" %>

<%@dotnet.itags.org.RegisterAssembly="AjaxControlToolkit"Namespace="AjaxControlToolkit"TagPrefix="cc1" %> 'DO I REALLY NEED THIS LINE?

<!DOCTYPEhtmlPUBLIC"-//W3C//DTD XHTML 1.1//EN""http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">

<htmlxmlns="http://www.w3.org/1999/xhtml">

<headrunat="server">

<title>Untitled Page</title>

</head>

<body>

<formid="form1"runat="server">

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

<br/>

<br/>

<div>

<asp:UpdatePanelID="UpdatePanel1"runat="server">

<ContentTemplate>

<asp:DropDownListID="DropDownList1"runat="server"Width="232px">

</asp:DropDownList><br/>

<br/>

<br/>

<cc1:CascadingDropDownID="CascadingDropDown1"runat="server"Category="cat1"LoadingText="Loading..."

PromptText="Select Category"ServiceMethod="GetCategory"ServicePath="WebService.asmx"

TargetControlID="DropDownList1">

</cc1:CascadingDropDown>

<br/>

<br/>

</ContentTemplate>

</asp:UpdatePanel>

</div>

</form>

</body>

</html>

Thanks Again!

Princess

Well, I figured it out. Turns out I had my folders in the wrong place. The way I was referencing the webservice, the App_Code file, App_Data, & Bin folders plus the web.config file have to be at the top level of your application folder.

Mystery Solved!


Thats nice..So mark the answer, so it will help for otheres.