This project has moved and is read-only. For the latest updates, please go here.

SPCascadeDropdowns and Presetting the parentColumn Value

Jan 17, 2010 at 7:20 PM
Edited Jan 17, 2010 at 7:44 PM

From drgolden on
"This is very helpful! Thanks. When I select an item in a dropdown the appropriate items are filtered in the related dropdown. Very straightforward! I am having an issue though, because I am prepopulating the parent using a query string (SelectedID=X). Apparently this JQuery script is designed to only filter the child column when the parent is changed. When the page loads, the child is filtered based on the item at the top of the parent list no matter which parent is actually chosen as a result of the query string. Do you have any suggestions regarding how I can have the child dropdown filtered automatically based on the parent that is has been chosen based on the query string? Thanks!!"

Jan 17, 2010 at 7:44 PM

You should be able to make this work by triggering the change event when you set the parentColumn value.  Are you actually setting the select property?  Also keep in mind that you'd need to call SPCascadingDropdowns *before* you set the value for it to work.

Just a note: There's no way for me to set an alert for comments on the Documentation pages, so I didn't see your comment until now. Because of this, it's probably better to use the Discussions instead with a link back to the Documentation page.


Feb 1, 2010 at 3:36 PM


First of all - Great stuff! Hopefully I'll come up with something to post on here that will be useful to others.  In the mean time I have a question related to the post above.

Second I have the SPCascadeDropdowns working for my project.  I have a parent and one child (both are dropdowns).

I am using some script that obtains the @ID from the querystring.  The top-level dropdown list's selected item is some text from the querystringID.  However, on Page Load the Child Dropdown is not invoked.  It is only invoked when a change to the Parent is made.  Could you elaborate on the Change event.  I am not so sure about the syntax.  Nor am I sure how to instantiate the Change event during the Page Load.



Feb 1, 2010 at 3:42 PM

If you've already got SPCascadeDropdowns in place, then you'll see that the parentColumn's change event is fired on its set up.  This ensures that the right childColumn values are shown right away.  If you want to set the parentColumn's selected value, do it after the call to SPCascadeDropdowns.  Setting the selected value ought to trigger the change event for the parentColumn.  If it doesn't, you can do so with some jQuery like:



Feb 1, 2010 at 7:26 PM


It is working now.  I had the javascript in a content editor web part that gets the querystring ID. I just called that function right before SPCascadeDropdowns function.  The javascript comes from the Microsoft Application Template "Budgeting and Tracking Multiple Projects."  Thanks for your help.




relationshipList: "",

relationshipListParentColumn: "",

relationshipListChildColumn: "",

parentColumn: "",

childColumn: ""




Feb 1, 2010 at 8:24 PM

Glad you got it working!