سؤال

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?

هل كانت مفيدة؟

المحلول

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

نصائح أخرى

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!

مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى sharepoint.stackexchange
scroll top