SharePoint Stack Exchange is a question and answer site for SharePoint enthusiasts. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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"
    SelectCommand="<Query><Where><Eq><FieldRef Name='ParentCode' /><Value Type='Text'>{BL1}</Value></Eq></Where><OrderBy><FieldRef Name='Title'/></OrderBy></Query>">
        <asp:Parameter Name="WebUrl" DefaultValue="/sites/NewsCore/" />
        <asp:Parameter Name="ListName" DefaultValue="Standing Data - BL2" />
        <asp:ControlParameter Name="BL1" ControlID="ddlBL1" PropertyName="SelectedValue" />
<asp:DropDownList ID="ddlBL2" runat="server"
    style="min-width:200px" AutoPostBack="false" />

Can anyone see what I've missed?

share|improve this question
up vote 0 down vote accepted

I ended up having to bind the dropdown contents in the code behind file for it to work with other requirements for the form.

If anyone's trying to do it using the code in the question, I found this article which suggests adding EnableViewState="false" to the filtered drop down to force it to get a data set with the new filter, instead of retrieving the old one from the View State.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.