I'm trying to filter the contents of a dropdown based on the selection in another dropdown, using this MSDN blog post and forum post.
The filtered dropdown appears with the correct data the first time the page is loaded, but when I change the first dropdown and the page posts back, the filtered dropdown doesn't change. I imagine it's something to do with the order that controls are created in the lifecycle, but I'm not sure how to fix it.
Here's the code for the filtered dropdown and data source.
<SharePoint:SPDataSource ID="sdsBL2" runat="server"
DataSourceMode="List"
UseInternalName="true"
SelectCommand="<Query><Where><Eq><FieldRef Name='ParentCode' /><Value Type='Text'>{BL1}</Value></Eq></Where><OrderBy><FieldRef Name='Title'/></OrderBy></Query>">
<SelectParameters>
<asp:Parameter Name="WebUrl" DefaultValue="/sites/NewsCore/" />
<asp:Parameter Name="ListName" DefaultValue="Standing Data - BL2" />
<asp:ControlParameter Name="BL1" ControlID="ddlBL1" PropertyName="SelectedValue" />
</SelectParameters>
</SharePoint:SPDataSource>
<asp:DropDownList ID="ddlBL2" runat="server"
DataSourceId="sdsBL2"
DataTextField="Title"
DataValueField="Code"
style="min-width:200px" AutoPostBack="false" />
Can anyone see what I've missed?