1-888-365-2779
+1-888-365-2779
Try Now
More in this section

Forums / General Discussions / Interface Widget for Custom Data

Interface Widget for Custom Data

3 posts, 0 answered
  1. Josh
    Josh  avatar
    25 posts
    Registered:
    28 Apr 2009
    17 Mar 2011
    Link to this post
    I was trying to get the Custom Interface widget when creating a custom field to work.  I followed the steps on this post:

    http://www.sitefinity.com/devnet/forums/sitefinity-4-x/general-discussions/using-a-custom-interface-widget-when-creating-a-custom-field.aspx

    but am still getting an "Exception has been thrown by the target of an invocation." when trying to save the new metafield.  I think the error may lie where I put the nulls but I am not sure what values are supposed to go in there.  Is there a working example that I could use otherwise?

    using System;
    using Telerik.Sitefinity.Web.UI.Fields;
    using Telerik.Sitefinity.Web.UI;
     
    namespace Telerik.Sitefinity.Samples
    {
        [FieldDefinitionElement(typeof(GenericCustomFieldEditorDefinitionElement))]
     
         
        class AssociatedImage : CompositeFieldControl
        {
            protected override System.Web.UI.WebControls.WebControl TitleControl
            {
                get { throw new NotImplementedException(); }
            }
       
            protected override System.Web.UI.WebControls.WebControl DescriptionControl
            {
                get { throw new NotImplementedException(); }
            }
       
            protected override System.Web.UI.WebControls.WebControl ExampleControl
            {
                get { throw new NotImplementedException(); }
            }
       
            protected override void InitializeControls(Web.UI.GenericContainer container)
            {
                throw new NotImplementedException();
            }
       
            protected override string LayoutTemplateName
            {
                get { throw new NotImplementedException(); }
            }
         
        }
    }
     


    public class GenericCustomFieldEditorDefinitionElement : Telerik.Sitefinity.Web.UI.Fields.Config.FieldControlDefinitionElement, Telerik.Sitefinity.Web.UI.Fields.Contracts.ITextFieldDefinition
    {
        public GenericCustomFieldEditorDefinitionElement(Telerik.Sitefinity.Configuration.ConfigElement parent) : base(null) { }
     
        public override DefinitionBase GetDefinition()
        {
            return null;
        }
     
        public int Rows
        {
            get { throw new NotImplementedException(); }
            set { Rows = value; }
        }
        public string HideIfValue
        {
            get { throw new NotImplementedException(); }
            set { HideIfValue = value; }
        }
     
        public Telerik.Sitefinity.Web.UI.Extenders.Contracts.IExpandableControlDefinition ExpandableDefinition
        {
            get { throw new NotImplementedException(); }
        }
     
    }

    Thanks,

    Josh
  2. Ivan Dimitrov
    Ivan Dimitrov avatar
    16072 posts
    Registered:
    12 Sep 2017
    18 Mar 2011
    Link to this post
    Hi ,

    Can you provide the stack trace of the error? Also in your classes the methods are not implemented at all.

    Greetings,
    Ivan Dimitrov
    the Telerik team
  3. Josh
    Josh  avatar
    25 posts
    Registered:
    28 Apr 2009
    21 Mar 2011
    Link to this post
    Hi Ivan,

    Thank you for your response.  I was actually able to find out how to create custom metafields from this post:

    http://www.sitefinity.com/blogs/slavoingilizov/posts/11-02-11/creating_a_thumbnail_selector_for_news_items.aspx


    Kind Regards,

    Josh
3 posts, 0 answered