<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
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?
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.
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.
Cranzy
Member
25 Points
5 Posts
Cascading Dropdown Doesn't Work - Please Help Me!! - Getting [Method Error 500]
Oct 25, 2006 11:02 AM|LINK
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
CascadingDropDown
bvanskiver
Member
74 Points
22 Posts
Re: Cascading Dropdown Doesn't Work - Please Help Me!! - Getting [Method Error 500]
Oct 25, 2006 03:52 PM|LINK
bvanskiver
Member
74 Points
22 Posts
Re: Cascading Dropdown Doesn't Work - Please Help Me!! - Getting [Method Error 500]
Oct 25, 2006 03:55 PM|LINK
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 }Cranzy
Member
25 Points
5 Posts
Re: Cascading Dropdown Doesn't Work - Please Help Me!! - Getting [Method Error 500]
Oct 26, 2006 05:28 AM|LINK
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
wazzzuup
Member
527 Points
156 Posts
Re: Cascading Dropdown Doesn't Work - Please Help Me!! - Getting [Method Error 500]
Nov 26, 2006 11:40 AM|LINK
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?
Yes I Am!
David Anson
Star
8728 Points
1847 Posts
Microsoft
Re: Cascading Dropdown Doesn't Work - Please Help Me!! - Getting [Method Error 500]
Nov 29, 2006 08:25 PM|LINK
http://dlaa.me/
http://blogs.msdn.com/b/delay/
This posting is provided "AS IS" with no warranties, and confers no rights.
TerryD64
Member
12 Points
3 Posts
Re: Cascading Dropdown Doesn't Work - Please Help Me!! - Getting [Method Error 500]
Jan 23, 2007 04:10 PM|LINK
With RC1 remember to change Microsoft.Web.... to System.Web.....
Peter Smith
Contributor
4605 Points
2109 Posts
Re: Cascading Dropdown Doesn't Work - Please Help Me!! - Getting [Method Error 500]
Jan 26, 2007 06:40 PM|LINK
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 :)
sburke_msft
Contributor
4396 Points
770 Posts
Microsoft
Re: Cascading Dropdown Doesn't Work - Please Help Me!! - Getting [Method Error 500]
Jan 26, 2007 07:58 PM|LINK
Does the CascadingDropDown in the SampleWebsite included with the Toolkit work for you? That's a complete piece of working code...
sujithmysore
Member
75 Points
44 Posts
Re: Cascading Dropdown Doesn't Work - Please Help Me!! - Getting [Method Error 500]
Apr 30, 2007 05:51 AM|LINK
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