Cascading Dropdown Doesn't Work - Please Help Me!! - Getting [Method Error 500]

Last post 12-04-2009 2:49 AM by mr_squall. 30 replies.

Sort Posts:

  • Cascading Dropdown Doesn't Work - Please Help Me!! - Getting [Method Error 500]

    10-25-2006, 7:02 AM
    • Member
      25 point Member
    • Cranzy
    • Member since 10-25-2006, 10:01 AM
    • Posts 5

    Hi,

     I Downloaded Ajax control yesterday. Im trying to get the cascadingdropdown working

    I added the carsservice.xml to my app_data folder just like the sample,

    On my form i add 1 combobox and the cascadingdropdown control

    The properties i set for the cascadingdropdown looks like this

    <cc1:CascadingDropDown ID="CascadingDropDown1" runat="server" TargetControlID="DropDownList1" PromptText="Select..." ServiceMethod="GetDropDownContentsPageMethod" Category="make">

    </cc1:CascadingDropDown>

    My Code behind looks like this    

    <WebMethod()> _
    Public Function GetDropDownContentsPageMethod(ByVal knownCategoryValues As String, ByVal category As String) As AjaxControlToolkit.CascadingDropDownNameValue()
            Dim cs As New GetCodeBlock
            Return cs.GetDropDownContents(knownCategoryValues, category)
        End Function

    The code in the webservice file looks like this

        Shared _Document As New XmlDocument
        Shared _Lock As New Object

        Public ReadOnly Property Document() As XmlDocument
            Get
                _Document = Nothing
                If (_Document Is Nothing) Then
                    SyncLock _Lock
                        _Document = New XmlDocument
                        _Document.Load(HttpContext.Current.Server.MapPath("~/App_Data/CarsService.xml"))
                    End SyncLock
                End If
                Document = _Document
                Exit Property
            End Get
        End Property

        Public ReadOnly Property Hierarchy() As String()
            Get
                Dim _Hierarchy As String() = {"make", "model"}
                Return _Hierarchy
            End Get
        End Property

        <WebMethod()> _
        Public Function GetDropDownContents(ByVal knownCategoryValues As String, ByVal category As String) As CascadingDropDownNameValue()
            Dim knownCategoryValuesDictionary As New StringDictionary


            knownCategoryValuesDictionary = CascadingDropDown.ParseKnownCategoryValuesString(knownCategoryValues)
            Return CascadingDropDown.QuerySimpleCascadingDropDownDocument(Document, Hierarchy, knownCategoryValuesDictionary, category)

        End Function

    When I run the page the combobox displays the Select... and no options except for

    [Method Error 500]

     

     

    Please HELP

    Filed under:
  • Re: Cascading Dropdown Doesn't Work - Please Help Me!! - Getting [Method Error 500]

    10-25-2006, 11:52 AM
    • Member
      72 point Member
    • bvanskiver
    • Member since 02-20-2006, 7:01 AM
    • Posts 21
    I am having the same problem, anyone have a solution?
    -- Bernd
  • Re: Cascading Dropdown Doesn't Work - Please Help Me!! - Getting [Method Error 500]

    10-25-2006, 11:55 AM
    • Member
      72 point Member
    • bvanskiver
    • Member since 02-20-2006, 7:01 AM
    • Posts 21

    I just found a solution, need to have the following attribute on the web service class:

    1    [Microsoft.Web.Script.Services.ScriptService()]
    2    public class MyService : System.Web.Services.WebService
    3    {
    4    
    5    }
    
     
    -- Bernd
  • Re: Cascading Dropdown Doesn't Work - Please Help Me!! - Getting [Method Error 500]

    10-26-2006, 1:28 AM
    • Member
      25 point Member
    • Cranzy
    • Member since 10-25-2006, 10:01 AM
    • Posts 5

    Great!! Works for me too....

    For all the VB folks out there - here is my line i inserted

    <Microsoft.Web.Script.Services.ScriptService()> _
    Public Class CarsService

    ......

    End Class

     

  • Re: Cascading Dropdown Doesn't Work - Please Help Me!! - Getting [Method Error 500]

    11-26-2006, 7:40 AM
    • Member
      527 point Member
    • wazzzuup
    • Member since 05-08-2006, 6:29 PM
    • Moscow
    • Posts 156

    GREAT GREAT GREAT!!!!

    I've tried out a lot of code modifications for this example, searched through docs and forums and it became like paranoya!!! But all the reason is one string before web service!!!

    Now I want to know 1) what is the meaning of this attribute and why didn't it worked without it? 2)If it so vitally important, why isn't it added by default or why isn't it nowhere mentioned in FAQs, examples and so on?

    Am I Evil?
    Yes I Am!
  • Re: Cascading Dropdown Doesn't Work - Please Help Me!! - Getting [Method Error 500]

    11-29-2006, 4:25 PM
    Answer
    • Star
      8,710 point Star
    • David Anson
    • Member since 04-11-2006, 1:39 AM
    • Microsoft
    • Posts 1,842
    The attribute is explained in the ASP.NET AJAX Beta 2 release notes as well as, for example, here: http://blogs.msdn.com/sburke/archive/2006/10/21/hint-components-that-use-web-services-with-asp-net-ajax-v1-0-beta.aspx.

    http://blogs.msdn.com/delay

    This posting is provided "AS IS" with no warranties, and confers no rights.
  • Re: Cascading Dropdown Doesn't Work - Please Help Me!! - Getting [Method Error 500]

    01-23-2007, 12:10 PM
    • Member
      12 point Member
    • TerryD64
    • Member since 06-05-2006, 6:41 PM
    • Posts 3
    Cranzy:

    Great!! Works for me too....

    For all the VB folks out there - here is my line i inserted

    <Microsoft.Web.Script.Services.ScriptService()> _
    Public Class CarsService

    ......

    End Class

     

    With RC1 remember to change Microsoft.Web....  to System.Web.....

  • Re: Cascading Dropdown Doesn't Work - Please Help Me!! - Getting [Method Error 500]

    01-26-2007, 2:40 PM
    • Contributor
      4,290 point Contributor
    • Peter Smith
    • Member since 03-19-2005, 9:58 AM
    • Posts 1,608

    does anyone have a complete piece of code that is actually working?
    I keep receiving that method error 500 even though I copied the cascading dropdown example from www.asp.net :S
    I followed the steps in this thread...(with the stupid one line above the class) but no luck...
    So if anyone has a working piece of code is friendly to post it here...I would greatly appreciate it :)

     

     

    please mark answers as 'Answered' and post back solutions when you figure stuff out that isnt in the post already.
  • Re: Cascading Dropdown Doesn't Work - Please Help Me!! - Getting [Method Error 500]

    01-26-2007, 3:58 PM
    • Contributor
      4,346 point Contributor
    • sburke_msft
    • Member since 04-04-2006, 7:28 PM
    • Redmond, WA
    • Posts 770
    • AspNetTeam

    Does the CascadingDropDown in the SampleWebsite included with the Toolkit work for you?  That's a complete piece of working code...

    Don't forget, this posting is provided "AS IS" with no warranties, and confers no rights.
  • Re: Cascading Dropdown Doesn't Work - Please Help Me!! - Getting [Method Error 500]

    04-30-2007, 1:51 AM
    • Member
      77 point Member
    • sujithmysore
    • Member since 04-30-2007, 5:33 AM
    • Posts 41

    hi there,

     i have tried adding <Microsoft.Web.Script.Services.ScriptService()> _ , but i get an error saying  "Type Microsoft.Web.Script.Services.ScriptService " is not defined. Any help would be appreciated.

     

    Thanks



  • Re: Cascading Dropdown Doesn't Work - Please Help Me!! - Getting [Method Error 500]

    04-30-2007, 3:14 AM
    • Contributor
      4,290 point Contributor
    • Peter Smith
    • Member since 03-19-2005, 9:58 AM
    • Posts 1,608
    Here my code as an example.
    Basically

    THIS:

    <Microsoft.Web.Script.Services.ScriptService()>

    HAS BECOME:

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


    THE CODE:

    <WebService(Namespace:=

    "http://tempuri.org/")> _

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

    <

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

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

    Public

    Class LocalCities

    Inherits System.Web.Services.WebService

    <WebMethod()> _

    Public Function GetCountries(ByVal knownCategoryValues As String, ByVal category As String) As CascadingDropDownNameValue()

    Dim countryAdapter As CountryMainCitiesTableAdapters.CountriesTableAdapter = New CountryMainCitiesTableAdapters.CountriesTableAdapter

    Dim countries As CountryMainCities.tblCountriesDataTable = countryAdapter.GetDataByCountries

    Dim values As New List(Of CascadingDropDownNameValue)

    For Each dr As DataRow In countries

    Dim CountryName As String = CType(dr("CountryName"), String)

    Dim CountryID As Integer = CType(dr("CountryID"), Integer)

    values.Add(

    New CascadingDropDownNameValue(CountryName, CountryID.ToString))

    Next

    Return values.ToArray

    End Function
    please mark answers as 'Answered' and post back solutions when you figure stuff out that isnt in the post already.
  • Re: Cascading Dropdown Doesn't Work - Please Help Me!! - Getting [Method Error 500]

    05-02-2007, 10:24 AM
    • Member
      4 point Member
    • Santoshk07
    • Member since 05-02-2007, 1:59 PM
    • Posts 2

    When I have added following line just above the Webservice class declaration, the Cascading Dropdown functionality is started working for me.

    [System.Web.Script.Services.ScriptService]

    It's amazing. But soon I noticed some limitations with Cascading Dropdown. When i tried to populate large amount of data it again started throwing [Method Error 500] error. This error is not related to the number items in the drop down. I think this is related to amount of data being populated in the dropdown. The functionality works if I have limited data. But if the no of item/ size of item increase the problem starts.

    Does anyone know solution to this problem? Your immediate help is much appreciated.

  • Re: Cascading Dropdown Doesn't Work - Please Help Me!! - Getting [Method Error 500]

    05-02-2007, 10:25 AM
    • Member
      4 point Member
    • Santoshk07
    • Member since 05-02-2007, 1:59 PM
    • Posts 2

    When I have added following line just above the Webservice class declaration, the Cascading Dropdown functionality is started working for me.

    [System.Web.Script.Services.ScriptService]

    It's amazing. But soon I noticed some limitations with Cascading Dropdown. When i tried to populate large amount of data it again started throwing [Method Error 500] error. This error is not related to the number items in the drop down. I think this is related to amount of data being populated in the dropdown. The functionality works if I have limited data. But if the no of item/ size of item increase the problem starts.

    Does anyone know solution to this problem? Your immediate help is much appreciated.

  • Re: Cascading Dropdown Doesn't Work - Please Help Me!! - Getting [Method Error 500]

    05-07-2007, 11:11 PM
    • Member
      77 point Member
    • sujithmysore
    • Member since 04-30-2007, 5:33 AM
    • Posts 41

    i had the same problem. increase the value of maxjsonlength variable in the jasonserialization tag in the web.config file... it should work..

  • Re: Cascading Dropdown Doesn't Work - Please Help Me!! - Getting [Method Error 500]

    07-01-2007, 2:13 AM
    • Member
      14 point Member
    • Websta4
    • Member since 03-07-2007, 12:18 PM
    • U.K.
    • Posts 44

     Same Problem Help

     I've downloaded the template changed the values in the xml file. it work fine but when I copy the same files in a different project it does work, it throw [Mrthod error 500].
     

     

    Help Please 

Page 1 of 3 (31 items) 1 2 3 Next >
Microsoft Communities