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.

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

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?

  • Could you link to the example on CodePlex, please? – Stu 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

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

| improve this answer | |

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!

| improve this answer | |
  • Bassist's answer is the correct one BTW. The lack of implementing the IFieldEditor interface is what would cause this error. The "Answer" to DL a new sample doesn't address the actual error and is not the solution to the problem. – Manic Farmer Aug 20 '18 at 21:58

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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