Filtering documents with value from Cascading drop down

Feb 2, 2010 at 5:07 PM

Hi Marc,
I need some help/guidence.
I have two lists and a document library.(same as you mentioned in your blog "Cascading drop-downs in SharePoint Form).
A Division List with one column DivisionName and a BranchList with two columns namely BranchName and DivisionName.
In this BranchList DivisionName is a look up column.
I have a document library which have documents belonging to each branch.
This library has three columns with Title,DivisionName and BranchName, where DivisionName and BranchName are look up columns.
I have bound two asp.net dropdown boxes to two SPDatasources linked to these lists.
I have also a DataFormWebPart bound to Document library showing Title,DivisionName and BranchName.

I want to pass values from Division DropDown to Branch DropDown and then after selecting a particular Branch pass value to Doucument DataFormWebpart so thatonly those documents are shown which belong to that Branch.

Will SPServices.SPCascadeDropdowns work with asp.net control? And how to pass branch drop down value to Doucument DataFormWebpart?

Also the form I used to put DropDown and DataFormWebPart is a aspx form attached to default master page.
I want to thank you in advance for your advice or help.
Bharat.

Coordinator
Feb 2, 2010 at 5:37 PM
Edited Feb 2, 2010 at 6:46 PM
Didn't I answer this for you recently somewhere else? This seems like a repeat.
M.
Feb 2, 2010 at 6:44 PM

Hi Marc,

Thansk for the reply, but I have not been able to get the above problem resolved. I have used following code to get cascading dropdown working.Am I missing something? I have used asp.net dropdown controls with autopost back.

<script type="text/javascript" language="javascript" src="http://mossdev2003:36814/JavaScripts/jquery-1.4.1.min.js"></script
<script type="text/javascript" language="javascript" src="http://mossdev2003:36814/JavaScripts/jquery.SPServices-0.5.0.js"></script
<script language="javascript" type="text/javascript">
$(document).ready(function() {
        $().SPServices.SPCascadeDropdowns({
        relationshipWebURL: "http://mossdev2003:36814",
        relationshipList: "Branches",
        relationshipListParentColumn: "DivisonName",
        relationshipListChildColumn: "BrancheName",
        parentColumn: "DivisonName",
        childColumn: "BrancheName"
        });
    });
</script>
  <table cellpadding="4" cellspacing="0" border="0" width="100%">
    <tr>
     <td id="_invisibleIfEmpty" name="_invisibleIfEmpty" colspan="3" valign="top" width="100%">
     <WebPartPages:WebPartZone runat="server" Title="loc:Header" ID="Header" FrameType="TitleBarOnly"><ZoneTemplate></ZoneTemplate></WebPartPages:WebPartZone> </td>
    </tr>
    <tr>
     <td id="_invisibleIfEmpty" name="_invisibleIfEmpty" valign="top" height="100%" style="width: 226px">
     <SharePoint:SPDataSource runat="server" DataSourceMode="List" UseInternalName="true" selectcommand="&lt;View&gt;&lt;/View&gt;" id="spdatasource3">
         <SelectParameters>
             <asp:Parameter Name="ListID" DefaultValue="{0471FE37-6652-4F29-913C-CCC26F9BABDD}"/>
         </SelectParameters>
         <DeleteParameters>
             <asp:Parameter Name="ListID" DefaultValue="{0471FE37-6652-4F29-913C-CCC26F9BABDD}"/>
         </DeleteParameters>
         <UpdateParameters>
             <asp:Parameter Name="ListID" DefaultValue="{0471FE37-6652-4F29-913C-CCC26F9BABDD}"/>
         </UpdateParameters>
         <InsertParameters>
             <asp:Parameter Name="ListID" DefaultValue="{0471FE37-6652-4F29-913C-CCC26F9BABDD}"/>
         </InsertParameters>
     </SharePoint:SPDataSource>
     Select Division<br>
     &nbsp;<asp:DropDownList runat="server" id="DropDownList1" Width="104px" DataValueField="DivisonName" DataTextField="DivisonName" DataSourceID="spdatasource3" AutoPostBack="True">     
     </asp:DropDownList>
     </td>
     <td id="_invisibleIfEmpty" name="_invisibleIfEmpty" valign="top" height="100%" style="width: 230px">
     <SharePoint:SPDataSource runat="server" DataSourceMode="List" UseInternalName="true" selectcommand="&lt;View&gt;&lt;/View&gt;" id="spdatasource1">
         <SelectParameters>
             <asp:Parameter Name="ListID" DefaultValue="{DD4603F6-DC42-4C5D-A290-8B550650B814}"/>
         </SelectParameters>
         <DeleteParameters>
             <asp:Parameter Name="ListID" DefaultValue="{DD4603F6-DC42-4C5D-A290-8B550650B814}"/>
         </DeleteParameters>
         <UpdateParameters>
             <asp:Parameter Name="ListID" DefaultValue="{DD4603F6-DC42-4C5D-A290-8B550650B814}"/>
         </UpdateParameters>
         <InsertParameters>
             <asp:Parameter Name="ListID" DefaultValue="{DD4603F6-DC42-4C5D-A290-8B550650B814}"/>
         </InsertParameters>
     </SharePoint:SPDataSource>    
     Select Branch<br>
     <asp:DropDownList runat="server" id="DropDownList2" Width="109px" Height="25px" DataValueField="BranchName" DataTextField="BranchName" DataSourceID="spdatasource1" AutoPostBack="True">
     </asp:DropDownList>
     </td>
     <td id="_invisibleIfEmpty" name="_invisibleIfEmpty" valign="top" height="100%">
     &nbsp;</td>
    </tr>


I will appriciate your help.

Thank you.

Coordinator
Feb 2, 2010 at 6:49 PM

SPCascadeDropdowns is meant to work with the standard (even customized, as long as the normal controls are used) SharePoint forms.  I'm not sure what the context is fo what you're doing here, but SPCascadeDropdowns will only work if the rendered HTML has the same structure as the forms.  Check out the documentation to see how I intend it to be used.

M.

Feb 2, 2010 at 7:16 PM

Thank you so much.

Bharat.