Monday, December 22, 2014

Cascaded Dropdown List in SharePoint List




1.Create List Name with Country
   Create Country Column  with single line of text

 
2.Create List Name with State
   Create State Column  with single line of text
   and Create Country lookup column

  
 
3. Create Employee List with 2 lookup columns State and Country using Above Two lists
    and required columns.
   Open the NewForm.aspx add the bellow code after Main Content Place Holder
 
<asp:Content ContentPlaceHolderId="PlaceHolderMain" runat="server" >
<script type="text/javascript" src="../../SitePages/JS/jquery-1.10.2.js"></script>
<script type="text/javascript" src="../../SitePages/JS/jquery.SPServices-0.7.2.js"></script>
<script type="text/javascript">   
$(document).ready(function()
{               
  $().SPServices.SPCascadeDropdowns(
  {
    relationshipList: "State",
    relationshipListParentColumn: "Country",                    
    relationshipListChildColumn: "State",                    
    relationshipListSortColumn: "ID",                    
    parentColumn: "Country",                    
    childColumn: "State",                   
    promptText: "Choose State...",                    
    debug: true               
  });    
}); 
<script>

Relation Ship Explanation As Follows:
 After Adding the Above Code Result as follows.
 

No comments:

Post a Comment