Hi
I'm trying to use the CascadingDropDown with a database in VB, using page methods.
My three DropDownLists are drpProject, drpFixFor and drpFixForSub. The drpProject control is populated fine when the page loads; and I'd expect the drpFixFor control to be populated when drpProject is changed, however, this is not happening.
The drpFixFor control is being enabled, but not populated - my "GetFixForList" function doesn't appear to be called at all. (I put a breakpoint in it, and the breakpoint isn't hit.)
Interestingly, if I remove ParentControlID="drpProject" from drpFixFor's extender, the function is called as expected when the page loads.
My aspx page is:
<%
@ Page Language="VB" MasterPageFile="~/MasterPage.master" AutoEventWireup="false" CodeFile="Test.aspx.vb" Inherits="Test" Title="" %>
<%
@ Register Assembly="AtlasControlToolkit" Namespace="AtlasControlToolkit" TagPrefix="atlasToolkit" %>
<
asp:Content ID="Content1" ContentPlaceHolderID="cphBody" runat="Server">
<table>
<tr>
<td style="width: 100px">Project:</td>
<td><asp:DropDownList ID="drpProject" runat="server" /></td>
</tr>
<tr>
<td style="width: 100px">Fix For:</td>
<td><asp:DropDownList ID="drpFixFor" runat="server" /></td>
</tr>
<tr>
<td style="width: 100px">Fix For Sub:</td>
<td><asp:DropDownList ID="drpFixForSub" runat="server" /></td>
</tr>
</table>
<atlasToolkit:CascadingDropDown ID="CascadingDropDown1" runat="server">
<atlasToolkit:CascadingDropDownProperties TargetControlID="drpProject" Category="Project" PromptText="(Select One)" ServiceMethod="GetProjectList" />
<atlasToolkit:CascadingDropDownProperties TargetControlID="drpFixFor" Category="FixFor" PromptText="(Select One)" ParentControlID="drpProject" ServiceMethod="GetFixForList" />
<atlasToolkit:CascadingDropDownProperties TargetControlID="drpFixForSub" Category="FixForSub" PromptText="(Select One)" ParentControlID="drpFixFor" ServiceMethod="GetFixForSubList" />
</atlasToolkit:CascadingDropDown>
</
asp:Content>
And my Code Behind page is:
Imports
AtlasControlToolkit
Imports
System.Web.Services
Partial
Class Test
Inherits System.Web.UI.Page
<WebMethod()> _
Public Function GetProjectList(ByVal knownCategoryValues As String, ByVal category As String) As CascadingDropDownNameValue()
Dim values As New Generic.List(Of CascadingDropDownNameValue)
For Each myProject As Project In Project.GetList
values.Add(
New CascadingDropDownNameValue(myProject.Name, myProject.ID))
Next
Return values.ToArray
End Function
<WebMethod()> _
Public Function GetFixForList(ByVal knownCategoryValues As String, ByVal category As String) As CascadingDropDownNameValue()
Dim values As New Generic.List(Of CascadingDropDownNameValue)
' Hardcode to Project "2" for debugging
For Each myFixFor As FixFor In FixFor.GetList(2)
values.Add(
New CascadingDropDownNameValue(myFixFor.Name, myFixFor.ID))
Next
Return values.ToArray
End Function
End
Class
Note: "Project" and "FixFor" are objects defined in my App_Code folder, and their "GetList" functions return data from the SQL database.
Any ideas?
Thanks,
Andrew