I'm trying to get the CascadingDropDown from the Atlas toolkit to work with a database. I receive this error at the lineReturn values.ToArray().
Error 1 Value of type '1-dimensional array of AtlasControlToolkit.CascadingDropDownNameValue' cannot be converted to 'AtlasControlToolkit.CascadingDropDownNameValue'
Here is the WebMethod.
<WebMethod()> _
PublicFunction GetMakes(ByVal knownCategoryValuesAsString,ByVal categoryAsString)As CascadingDropDownNameValue
Dim makeAdapterAs CarsTableAdapters.MakeTableAdapter =New CarsTableAdapters.MakeTableAdapter()
Dim makesAs Cars.MakeDataTable = makeAdapter.GetMakes()
Dim valuesAs List(Of CascadingDropDownNameValue) =New List(Of CascadingDropDownNameValue)()
ForEach drAs DataRowIn makes
Dim makeAsString =CStr(dr("Make"))
Dim makeIdAsInteger =CInt(dr("MakeID"))
values.Add(New CascadingDropDownNameValue(CStr(dr("Make")), dr("MakeID").ToString()))
Next dr
Return values.ToArray()
EndFunction
Any Ideas?
Rgds
Dave
Replace
PublicFunction GetMakes(ByVal knownCategoryValuesAsString,ByVal categoryAsString)As CascadingDropDownNameValue
With
PublicFunction GetMakes(ByVal knownCategoryValuesAsString,ByVal categoryAsString)As CascadingDropDownNameValue()
CascadingDropDownNameValue() is an array, butCascadingDropDownNameValue is not
Thanks lotusinriver. It works perfectly now.
Dave
You are very welcome.
No comments:
Post a Comment