SharePoint Cascading Dropdown - Unlimited siblings


I came across a requirement for implementing a cascading dropdown for one of my client. Since it was an urgent requirement, I googled it to find a source from codeplex and on other open source forum.

DataCog's cascading dropdown was the first one on the search result. I decided to use the source, but found few enhancements needed to it.
http://datacogs.com/datablogs/archive/2007/08/26/641.aspx

It limited the implementation to parent to child. It implemented a Parent control and a Child control. To use it, your list/library should have a Parent and a child control. You cannot really cascade the effect to multiple level. It was a constraint for me.

I used the source code provided by DataCogs, and eliminated the Parent control by creating couple of properties and it works fine for multiple siblings.

 
The modified source code is attached.

Comments are welcome.
___________________________________________
Anbu Thangarathinam

Updated: The source code attached was the latest one, but the package was not. Uploading the newer file.

SharePointSnippets.UI.Controls.CascadingDropdown.zip (87.64 kb)

Updated [Jan 10, 2009] : I have added a blog on configuration. Click here to view

Currently rated 2.3 by 27 people

  • Currently 2.296297/5 Stars.
  • 1
  • 2
  • 3
  • 4
  • 5

Posted by: Anbu
Posted on: 11/16/2008 at 10:36 PM
Tags: ,
Categories: .NET | Sharepoint
Actions: E-mail | Kick it! | DZone it! | del.icio.us
Post Information: Permalink | Comments (48) | Post RSSRSS comment feed

Related posts

Comments

Jimmy VC be

Wednesday, December 03, 2008 12:34 PM

Hey Anbu ,

Your sollution is exactly what I need , but the zip file that is attached here seems to be missing some files ( like SharePointSnippets.UI.Controls.dll and CascadingDropdown.wsp). Could you please look into that and let me know something.

thx in advance .

Jimmy

Dirk Eberhardt de

Thursday, December 04, 2008 6:00 AM

I also think the WSP File is the old one? Can you please create a WSP File with the new solution?!

Thanks in advance.
Dirk

rammurthy in

Thursday, December 04, 2008 7:08 AM

The SharePointSnippets.UI.Controls.dll is old one, can you update the wsp file

Thanks

Sarith S in

Tuesday, December 09, 2008 8:06 AM

Can you please post the latest source and solution files? The one attached is the old version.

Thanks!

Sarith S in

Wednesday, December 10, 2008 3:06 AM

Hi Anbu,

When I deploy the solution, the deployment completes successfully. I also see the column name when trying to create a new column in a list. However, when I type a name for the new column and select the Cascading Drop Down 1.0 column as the type, it gives me an unknown error. Any idea what could have gone wrong?

Thanks!

Dirk Eberhardt de

Wednesday, December 10, 2008 7:22 AM

Hi,
same problem like Sarith S! Any idea?

Sarith S in

Thursday, December 11, 2008 8:52 AM

Hi Dirk,

Any luck in resolving this issue? I tried rebuilding the solution file and deploying it but I still get the same 'Unknown Error'.

Thanks

Sarith S in

Friday, December 12, 2008 4:03 AM

I was able to resolve the 'Unknown Error' and got this to install and render correctly but when I create the new column and choose the list to populate my dropdown, the values dont appear when creating a new record.

Anbu how do you make this work??

John mt

Monday, December 15, 2008 9:31 AM

Hi,

This is a solution I have been after for some time. Can any one please help to resolve the ‘Unknown Error’ issue?

Thanks

Anbu in

Monday, December 15, 2008 9:56 AM

Thanks for your interest in the tool..

To use the custom field, you can create a parent field with a set of parameters.

1. Press the Load Lists button and then choose a List
2. Choose a List, a Value field and a Text Field. The value field will be used to link to the child table.
3. Type the Display name of the "Child field" - you're going to create later.
4. Check the "Is Parent Field".
5. Column to Join to Parent - This has been customized to have list of values in single list containing Value, Key and Parent Key columns. The Parent records will have "Parent Key" field as null, while for other records, it will map to the parent record.
If you have multiple lists to link, you can create a dummy field like "IsInactive" and set it to "Null". You can set the value to "Yes" when the item should be hide.

Hope this helps.

_____________________________
Anbu Thangarathinam

John mt

Monday, December 15, 2008 11:19 AM

Hi,

Many thanks Anbu for the prompt response, but the ‘Unknown Error’ problem is actual occurring before the custom field and controls are rendered. I assume this is the same error Sarith S had.

Would be very much appreciate if you can help solving this error.

Sarith S in

Wednesday, December 17, 2008 12:46 AM

Hi,

I've been able to resolve the 'Unknown Error' and get this to render correctly. Will try out Anbu's inputs on using the cascading dropdown list. Will post my feedback and some points on how to get the 'Unknown Error' resolved in a couple of hours.

-----------------------
Sarith S

Gilad

Wednesday, December 17, 2008 5:43 AM

Sarith s Hi , can you write down your soultion for the "unknown error" that you find , it's can be very useful for me...
thanks, gilad.

Sarith S in

Wednesday, December 17, 2008 6:22 AM

Troubleshooting the 'Unknown Error' issue
------------------------------------------
In my environment, the 'Unknown Error' was caused due to two reasons: 1 - Versioning and 2 - Path to the 'InputFormSection' and 'InputFormControl' user controls.

'Unknown Error' is a generic error message. To real the real reason, first enable debugging in the web.config file so that exception is displayed and handled by SharePoint. Change and set these settings in the web.config file -
CallStack="true"
Debug="true"
CustomErrors mode="Off"

Once debugging has been enabled, restart IIS and then try creating a new column using the Cascading Dropdown List 1.0 field.

ERROR 1:
If you see an error that says something like:
"Could not load assembly "SharePointSnippets.UI.Controls.CascadingDropdown, Version=2.0.0.0, xxxxxxxxxxxxxx", then modify the following files to reflect the correct four-part assembly name (I use .NET Reflector to get the full assembly name):

1. Manifest.xml
Check the <SafeControl Assembly=”xxxxxx” Namespace=”xxxx” Typename=”*” Safe=”True”/>

2. CascadingDropDownListFieldEditControl.ascx
Check the <%@ Control Language="C#" Inherits=”xxxxxx” AutoEventWireup=”false” %>

Save the two files, restart IIS and try creating a new column.

ERROR 2:
You may next see an error that says something like:
"The file '/_controltemplates/_controltemplates/InputFormControl.ascx' does not exist at .......... blah blah"

For this you again need to edit HTML source of the CascadingDropDownListFieldEditControl.ascx file.

Change the 'SRC' paths of the two

<%@ Register TagPrefix="wssuc" TagName="InputFormControl"
<%@ Register TagPrefix="wssuc" TagName="InputFormControl"

to reflect the correct path. In my case I had to just remove he "_controltemplates/" part from the source "~/_controltemplates/InputFormControl".

Save the file and restart IIS. You should be good to go.

Just to point out, I still have not been able to use the Cascading Dropdown List 1.0 field. According to Anbu's Point No. 5, I cannot leave the Column to Join to Parent as null. By default when the sharepoint list is selected, the ContentTypeId or something similar (which I can't remember right now) is selected. I can't leave it blank for the Parent Field.

If anyone gets this sucker working, please share with the rest of us. Thanks!

Gopinath D - Author SharePointSnippets.com in

Thursday, December 18, 2008 2:17 PM

Hi All,

I have solved the mentioned issue. Please do the following:

1. Open CascadingDropDownListFieldEditControl.ascx file
2. Change Version=2.0.0.0 to Version=1.0.0.0 in the first line.

Enjoy...........!!!!

Sarith S in

Friday, December 19, 2008 5:31 AM

Here's another custom field control by Patrick.

http://blog.12thwave.com/?p=7


Lucky in

Monday, December 29, 2008 6:59 AM

Hi Gopinath,
Can you please send me the example solution that you have aready solved. I have also downloed but its giving lots of erros.
Thanks in Advance
Lucky
email at: e.download@hotmail.com

Biggles T se

Monday, December 29, 2008 11:13 AM

Thanks a lot for this Anbu!

BobV us

Monday, December 29, 2008 4:06 PM

Hi,

I'm still having the error when trying to add a column to the list. Here is the error:

Could not load the assembly 'SharePointSnippets.UI.Controls.CascadingDropdown, Version=2.0.0.0, Culture=neutral, PublicKeyToken=3d9687184c995923'. Make sure that it is compiled before accessing the page. at System.Web.UI.TemplateParser.GetType(String typeName, Boolean ignoreCase, Boolean throwOnError)
at System.Web.UI.TemplateParser.ProcessInheritsAttribute(String baseTypeName, String codeFileBaseTypeName, String src, Assembly assembly)
at System.Web.UI.TemplateParser.PostProcessMainDirectiveAttributes(IDictionary parseData)
Troubleshoot issues with Windows SharePoint Services.

Here is the line from cascadingdropdownlistfieldeditcontrol.aspx
<%@ Control Language="C#" Inherits="SharePointSnippets.UI.Controls.CascadingDropDownListFieldEditControl,SharePointSnippets.UI.Controls.CascadingDropdown, Version=2.0.0.0, Culture=neutral, PublicKeyToken=3d9687184c995923"
AutoEventWireup="false" %>

Here is the line from manifest.xml
<SafeControl Assembly="SharePointSnippets.UI.Controls.CascadingDropdown,Version=2.0.0.0, Culture=neutral, PublicKeyToken=3d9687184c995923"
Namespace="SharePointSnippets.UI.Controls"
TypeName="*"
Safe="True"/>


Any thoughts???

Sarith S in

Monday, January 05, 2009 3:01 AM

BobV,

I would suggest you look up the actual SharePointSnippets.UI.Controls.CascadingDropdown.dll deployed in the GAC. Look at the full assembly name of that dll and check if it matches the aspx and xml files.

Sarith

Matt us

Tuesday, January 06, 2009 5:50 PM

I am trying to use this, and figured out the 1.0.0.0 vs 2.0.0.0 problem. I can now add the columns, but when I go to create a new entry the dropdowns are blank.

What I did:
Create a List that has two columns - the first being the 'parent column' the second being the 'child' - ex
State City
MN Saint Paul
MN Minneapols
MN Rochester

I then tried to add two columns to a different list

Parent Column
Column Name: State
Type: Cascading Drop Down List 1.0
Site Url: http://wss/statestuff
List Name: Cities
Column for Value: State
Column for Text: State
Child Control Name to join: City
Is this a Root Item: checked
Column to Join to Parent: did not touch - left at default of "Content Type ID"

Column Name: City
Type: Cascading Drop Down List 1.0
Site Url: http://wss/statestuff
List Name: Cities
Column for Value: City
Column for Text: City
Child Control Name to join:
Is this a Root Item: unchecked
Column to Join to Parent: State

When I go to create a new entry both of the dropdowns for State and City are empty. No errors.

Any thoughts?

thanks
m

Pankaj us

Tuesday, January 06, 2009 8:31 PM

Hi Anbu,
if I want to create a content type which will have some site columns of this type (your field control), what should be the xml schema for that column?
e.g. if you create a site column of field type "Text" and want to deploy it as a Feature, the schema looks like:-

<?xml version="1.0" encoding="utf-8" ?>
<Elements xmlns="http://schemas.microsoft.com/sharepoint/">
<Field
ID="{63590418-87F5-4fa7-AF50-B371C88F2F56}"
Name="CustomerAccountNumber"
DisplayName="Customer Account Number"
Description="A customer account number used within the company."
Type="Text"
MaxLength="10"
Group="Grounding Site Columns"
>
</Field>
</Elements>

So how should it look like if the site column is of [b]your[/b] field type?

thanks a lot,
Pankaj

Anbu Thangarathinam in

Wednesday, January 07, 2009 1:33 PM

Hi Matt,

This control has been developed to use single list containting multiple levels parent-child records. The highest level entries should have the "ParentField" with NULL value. Subsequently the other child records can have reference to the ParentField.

I'm planning to post a detailed blog on this.

Thanks for your comments.

_________________________
Anbu Thangarathinam

Anbu Thangarathinam in

Wednesday, January 07, 2009 1:35 PM

Pankaj,

I did not try creating the fields using schema. You may need to use "Cascading Dropdown 1.0" as the type name.

Thanks for your comments,
_______________________
Anbu Thangarathinam

Sarith S in

Friday, January 09, 2009 4:00 AM

All,

I would recommend using Patrick's solution. It has the same functionality and works great. Check out the solution at:

http://blog.12thwave.com/?p=7

Chat Hong sg

Friday, January 09, 2009 4:41 AM

Hi All,

Successfully installed this Cascading Dropdown. Smile

However, I ran into problem when I tried to use this with people and groups. I would like the parent list to be a share point group and the child list to be the people in share point group selected in the parent list.

Anyone has done this before?

cheers

karen gb

Friday, January 09, 2009 5:16 AM

Hi All,

Could someone please show an example of how to create the actual columns? for both a parent and child?

I have deployed the code however the parent and child lists do not seem to populate any values for any combination that I try.

Many thanks.

Anbu Thangarathinam in

Saturday, January 10, 2009 7:37 AM

Hi All,

I have posted a blog on the configuration. Please refer http://www.sharepointsnippets.com/post/2009/01/Cascading-Dropdown---Configuration.aspx.

Steve Fritsche us

Tuesday, January 27, 2009 3:30 PM

Hi all,

This is exactly what I need, but I am in way over my head. I'm trying to follow the Read.me instructions but I have no idea what a "GAC" is. So, I opted for the "OR" instructions to use the STSADM commands. The "addsolution" command failed with the following error:

Object reference not set to an instance of an object.
C:\solutions\SharePointSnippets.UI.Controls.CascadingDropdown\DeploymentFiles\ProductionDeployment\Package\CascadingDropdown.wsp: The Solution installation failed.

Can you help me with that?

Thanks,
Steve

Rock

Sunday, February 08, 2009 8:24 PM

This fails if we do a content deploymnet, have you tested this control for content deployment we get the same: Object reference not set to an instance of an object.

And this happens where we have the SPContext reference, this code certainly fails.

What is the solution?

Ryan Moore ca

Thursday, February 12, 2009 12:48 PM

I have been using this control for 3-4 months, and it mostly does the job. I have noticed one item, that i'm not sure if it's a bug or simply the way the control works. I am not sure if an upgrade is required or not..

The issue i'm having is that when i update a column value for a Parent Item, it does not populate in the list.

Let me explain.

I have 3 lists. Country, City, Street. Similar to the example on the other site. In the street list, i have Country and City configured as Parent & Child Drop down respectively. So when i add a street, i choose a Country, City, then type in a street name it works perfectly. But when i go into the country list, and update the name of the country, the update does not appear in my street list. So if i change the name of the country in the Country List from US to U.S.A., US will still appear as the column value in my street list.

I think my control may be an older version as i do not get the Yes, this is a Root Field checkbox option. Has this item been fixed in this newer version, or is this still an issue?

Sham us

Friday, February 13, 2009 11:28 PM

Hi, I managed to install and configure the list, but when I try to add an item, I get an unknown error. Does anyone have any ideas as to what may be causing this error?
Thanks
Sham

DJ ae

Thursday, February 19, 2009 9:53 AM

hi all,
i did couble of things and its working fine with me

first of all i followed Gopinath D advice which is

1. Open CascadingDropDownListFieldEditControl.ascx file
2. Change Version=2.0.0.0 to Version=1.0.0.0 in the first line.

and i changed the URL inside "installwsp.bat" file into my sharepoint site
and i changed the directory path inside "createwsp.bat" file into the proper path on my machine
the current path is on drive D as the following
D:\Program Files\Microsoft Visual Studio 9.0\SmartDevices\SDK\SDKTools\makecab.exe
so change it into drive C because most of the casses evryone that i know installing his applications on C drive

and after that i executed the "createwsp.bat" first and once it done i executed the "installwsp.bat" and after that i test it and its working 100% perfect
good job Anbu
you saved my life ;)

Gopinath in

Friday, March 06, 2009 5:57 AM

Hi All,

We strongly recommend you that please download the latest code from of Cascading DropdownControl.

Please follow the instructions which is specified in the following post http://www.sharepointsnippets.com/post/2009/01/Cascading-Dropdown---Configuration.aspx


Thanks

Wayne Shirley us

Tuesday, April 21, 2009 4:03 PM

I'm having the error problem described above and am trying to use .Net Reflector to find the "full assembly name" for the Cascading DropdownControl.

However, I cannot seem to find it anywhere. Could someone point me to the corret location in .Net Reflector to find the full assembly name?

I've tried searching using "cascading" or "drop" or "snippets" but cannot locate it.

Thanks.

Wayne Shirley us

Tuesday, April 21, 2009 11:49 PM

Please withdraw my last post -- problem solved.

Vijay us

Tuesday, April 28, 2009 11:16 AM

This is an excellent post...
Is there any way to make this multiselect drop down?

Jason us

Tuesday, April 28, 2009 5:32 PM

Anyone know of a way to have the results alphabetized? It seems that they display in the order of ID rather then any other sort order. Anyone have a solution so as users add / edit drop down fields it keeps them in alphabetical order?

Thanks,
Jason

Anbu in

Monday, May 04, 2009 9:25 PM

Jason,

I did it for another application just by extending the same control. Add a new field to "Order by Field". When you query the list, make sure you are passing the order by field in the <OrderBy> query.

Hope this will help you.

Vijay us

Tuesday, May 05, 2009 12:16 PM

How do I make this multiselect at the last child dropdown?

saç ekimi

Thursday, May 07, 2009 6:26 AM

Hi all;
To me, this is bad practice. As anything that occurs in that page will be thrown away and be treated as a User Error. For example, what would happen if the SQL server went down? Do you and the rest of the team advocate catching all? I would love to get your insight on this.

Sarith in

Monday, May 18, 2009 5:16 AM

Check this website - Cascading Drop Down List With Filter

http://sharepointsircar.blogspot.com/2009/02/cascading-dropdownlist-custom-field.html

evden eve nakliyat

Friday, May 29, 2009 9:16 AM

good info.

Santiago ar

Monday, June 08, 2009 2:42 PM

Hi Abnu, nice control!!

...I implemented it, but the list show me the "CategoryCode" not the "CategoryName"

thanks!

cam balkon tr

Monday, June 22, 2009 12:09 PM

anadolu cam balkon

cam balkon tr

Monday, June 22, 2009 12:10 PM

cam balkon

cam balkon tr

Monday, June 22, 2009 12:11 PM

marmara cam balkon

sciare.usr it

Tuesday, June 30, 2009 12:35 PM

Hi, can you post here the link at most recent source package? I have downloaded the .zip attached with your code but when I have deployed all on my server (the .wsp builded from the source) the control that I have found are the standard "DataCog's cascading dropdown" and not your configurated dropdown (with multiple cascade level).
Thank's Wink

Add comment


 

  Country flag

[b][/b] - [i][/i] - [u][/u]- [quote][/quote]