lately I have been trying to develop a custom field (cascading dropdown) for sharepoint 2010. I am using the sample from codeplex. the problem is that the sample is for sharepoint 2007 and uses the as follows in XML.

 <PropertySchema>
  <Fields>
    <Field Name="SiteUrl" Hidden="TRUE" DisplayName="SiteUrl" MaxLength="500" DisplaySize="100" Type="Text">
    </Field>

for some reason in Sharepoint 2010 this seems not to be working and is giving the following error:

System.InvalidCastException: Unable to cast object of type 'ASP._controltemplates_cascadingdropdowneditfieldcontrol_ascx' to type 'Microsoft.SharePoint.WebControls.IFieldEditor'.
at Microsoft.SharePoint.ApplicationPages.FieldCustomizationPage.CreateChildControls()
at Microsoft.SharePoint.ApplicationPages.FieldNewPage.CreateChildControls()
at System.Web.UI.Control.EnsureChildControls()
at Microsoft.SharePoint.ApplicationPages.FieldCustomizationPage.OnLoad(EventArgs e)
at Microsoft.SharePoint.ApplicationPages.FieldNewPage.OnLoad(EventArgs e)
at System.Web.UI.Control.LoadRecursive()
at System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)

is there a way to add same things in CreateChildControl instead of PropertySchema?? or anyone has suggestions to solve this issue?

link|improve this question

Could you link to the example on CodePlex, please? – Stuart Pegg Aug 30 '11 at 12:12
hi, the following is the link to what seems like the project, I managed to find same one open source but did not keep the link :S. basically it is the same as this one cascddlistwithfilter.codeplex.com – IanCian Aug 30 '11 at 12:46
I can post the xml file if it is of any help, and the class using ifieldeditor main parts – IanCian Aug 30 '11 at 12:47
feedback

2 Answers

up vote 1 down vote accepted

Found this site which did the cascading drop down very easily: please refer to http://www.sharepointkings.com/2010/09/sharepoint-cascading-drop-downs-using.html

link|improve this answer
feedback

This error may occure if your custom editor control 'ASP._controltemplates_cascadingdropdowneditfieldcontrol_ascx does not implement IFieldEditor interface or doing it wrong. MSDN recommends to use custom editor controls. Here is another greate example to start with. Hope it helps!

link|improve this answer
feedback

Your Answer

 
or
required, but never shown

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