Hi wndrboy2k3,
To access the two parameters – @ModelID & @Year, we simply need to find them from the “knownCategoryValues” which is sent to the final CascadingDropDown control’s ServiceMethod as a parameter.
For example, let’s have a look at the sample method which demonstrates how the Model control the Color:
<WebMethod()> _
Public Function GetColors(ByVal knownCategoryValues As String, ByVal category As String) As CascadingDropDownNameValue()
Dim kv As StringDictionary = CascadingDropDown.ParseKnownCategoryValuesString(knownCategoryValues)
Dim ModelId As Integer
If ((Not kv.ContainsKey("Model")) Or (Not Int32.TryParse(kv("Model"), ModelId))) Then
Return Nothing
End If
Dim carColorAdapter As New dsModelColorsTableAdapters.ModelColorsTableAdapter()
Dim colorValues As New List(Of CascadingDropDownNameValue)()
For Each row As DataRow In carColorAdapter.GetColorsByModelId(ModelId)
colorValues.Add(New CascadingDropDownNameValue(row("ColorName").ToString(), row("ColorId").ToString()))
Next
Return colorValues.ToArray()
End Function
Similarly, we may get the @Year like this
Dim Year As Integer
If ((Not kv.ContainsKey("Year")) Or (Not Int32.TryParse(kv("Year"), Year))) Then
Return Nothing
End If
If each two CascadingDropDowns has grade by grade relationship between parent and child, all the Category names and the selected values will be saved in the “knownCategoryValues” in the format “Make:XXXX;Modal:XXXX;Year:XXXX;” (XXXX is the value). Thus, we can get either of the Categories’ selected value.
You may download the sample code by referring the tutorial video here: http://www.asp.net/learn/ajax-videos/video-278.aspx
Have my suggestions achieved your goal?
Best regards,
Zhi-Qiang Ni