Paul, It really depends on how you have setup the XML file that defines your custom field. Looks like you XML file should contain similar to: <?xml version="1.0" encoding="utf-8" ?> <FieldTypes> <FieldType> <Field Name="FieldTypeClass"> CEO.SP14.CascadingLookUp, CEO.SP14.CascadingLookUp, Version=1.0.0.0, Culture=neutral, PublicKeyToken= xxxxxxxxxxxxxxxx</Field> <Field Name="FieldEditorUserControl">/_controltemplates/CEO.SP14.CascadingLookUp/clueditcontrolwithfilter.ascx</Field>
The reason you use ASCX files is so you can use the design surface. When properly using the designer, this will create your code-behind with a partial class so that it can include the designer generated code. Unlike previousl versions of Studio, you don't have to worry about Visual Studio 2010 deploying your code-behind files. Your class declaration should look like: namespace CEO.SP14.CascadingLookup { public partial class CLUEditControlWithFilter : UserControl, IFieldEditor { If you still can't get it to work, I would download some of the example custom field code in the SharePoint SDK as a reference to compare to yours. Cheers, James. ________________________________ James Boman ■ Telephone: +61 (08) 7200 1100 ■ Mobile: +61 (0) 417 857 298 ■ Web: http://www.ipmo.com.au || http://www.projectserver.com.au From: ozmoss-boun...@ozmoss.com [mailto:ozmoss-boun...@ozmoss.com] On Behalf Of Paul Noone Sent: Wednesday, 28 March 2012 12:46 PM To: 'ozMOSS' Subject: RE: Parser error with custom field control I think I've found the problem but am not sure how to resolve it. My assembly name and default namespace is CEO.SP14.CascadingLookup. However the designer file is showing the following: namespace CEO.SP14 { public partial class CascadingLookUp { Shouldn't this be: namespace CEO.SP14.CascadingLookup { public partial class CLUEditControlWithFilter { From: ozmoss-boun...@ozmoss.com [mailto:ozmoss-boun...@ozmoss.com] On Behalf Of Paul Noone Sent: Wednesday, 28 March 2012 11:15 AM To: 'ozMOSS' Subject: RE: Parser error with custom field control Hi James, Yes, I can confirm everything is as you state. The only exception is that I'm not specifying partial in my class declaration. From: ozmoss-boun...@ozmoss.com [mailto:ozmoss-boun...@ozmoss.com] On Behalf Of James Boman Sent: Tuesday, 27 March 2012 2:08 PM To: ozMOSS Subject: RE: Parser error with custom field control Paul, Looks like this ASCX is actually the control for the field editor. Two things - the ASCX needs to be in a folder in the CONTROLTEMPLATES directory, and the usercontrol code-behind must implement the IFieldEditor interface. Declare your class in the code-behind like this: public partial class MyFieldEditor : UserControl, IFieldEditor Cheers, J. ________________________________ James Boman ■ Telephone: +61 (08) 7200 1100 ■ Mobile: +61 (0) 417 857 298 ■ Web: http://www.ipmo.com.au || http://www.projectserver.com.au From: ozmoss-boun...@ozmoss.com [mailto:ozmoss-boun...@ozmoss.com] On Behalf Of Paul Noone Sent: Tuesday, 27 March 2012 8:48 AM To: 'ozMOSS' Subject: RE: Parser error with custom field control OK. So I commented out the code behind reference and now get this. Does that offer a clue?? Unable to cast object of type 'ASP._controltemplates_ceo_cascadinglookup_clueditcontrolwithfilter_ascx' to type 'Microsoft.SharePoint.WebControls.IFieldEditor'. Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code. Exception Details: System.InvalidCastException: Unable to cast object of type 'ASP._controltemplates_ceo_cascadinglookup_clueditcontrolwithfilter_ascx' to type 'Microsoft.SharePoint.WebControls.IFieldEditor'. Source Error: An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below. Stack Trace: [InvalidCastException: Unable to cast object of type 'ASP._controltemplates_ceo_cascadinglookup_clueditcontrolwithfilter_ascx' to type 'Microsoft.SharePoint.WebControls.IFieldEditor'.] Microsoft.SharePoint.ApplicationPages.FieldCustomizationPage.CreateChildControls() +1189 Microsoft.SharePoint.ApplicationPages.FieldNewPage.CreateChildControls() +27 System.Web.UI.Control.EnsureChildControls() +146 Microsoft.SharePoint.ApplicationPages.FieldCustomizationPage.OnLoad(EventArgs e) +83 Microsoft.SharePoint.ApplicationPages.FieldNewPage.OnLoad(EventArgs e) +18 System.Web.UI.Control.LoadRecursive() +66 System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +2428 From: ozmoss-boun...@ozmoss.com<mailto:ozmoss-boun...@ozmoss.com> [mailto:ozmoss-boun...@ozmoss.com]<mailto:[mailto:ozmoss-boun...@ozmoss.com]> On Behalf Of Paul Noone Sent: Tuesday, 27 March 2012 8:54 AM To: 'ozMOSS' Subject: RE: Parser error with custom field control I could but then nothing would render at all I don't. It seems that the problem is with parsing the field, so maybe the XML schema has changed? The control definitely inherits from System.Web.UI.UserControl! From: ozmoss-boun...@ozmoss.com<mailto:ozmoss-boun...@ozmoss.com> [mailto:ozmoss-boun...@ozmoss.com]<mailto:[mailto:ozmoss-boun...@ozmoss.com]> On Behalf Of Paul Turner Sent: Tuesday, 27 March 2012 8:44 AM To: ozMOSS Subject: RE: Parser error with custom field control Have you tried to take the "CodeBehind" out. Regards Paul Turner ________________________________ NOTICE - This communication is intended only for the person or entity to which it is addressed and may contain confidential and/or privileged material. Any review, retransmission, dissemination or other use of, or taking any action in reliance on, this communication by persons or entities other than the intended recipient is prohibited. If you are not the intended recipient of this communication please delete and destroy all copies and telephone SMS Management & Technology on 1300 842 767 immediately. Any views expressed in this Communication are those of the individual sender, except where the sender specifically states them to be the views of SMS Management & Technology. Except as required by law, SMS Management & Technology does not represent, warrant and/or guarantee that the integrity of this communication has been maintained nor that the communication is free from errors, virus, interception or interference.
_______________________________________________ ozmoss mailing list ozmoss@ozmoss.com http://prdlxvm0001.codify.net/mailman/listinfo/ozmoss