More in this section

Forums / Developing with Sitefinity / Custom Generic Content Designer

Custom Generic Content Designer

2 posts, 0 answered
  1. Elena
    Elena avatar
    3 posts
    15 Jan 2009
    15 Sep 2009
    Link to this post


    I work on customizing the GenericContentDesigner, as we need to add two new fields (textboxes) aside from the text content area.  These two fields are called heading and imageID. Basically, the steps I have followed are:
    - I have created a new provider called 'Community';
    - I created a new GenericContent called 'Community' which has two new meta fields:'Heading' and 'ImageID';
    - I created a new template for GenericContentDesigner in which I have added two textboxes called 'heading', and 'imageID';
    - Then I have created a new class, CommunityDesigner which inherits from GenericContentDesigner;
    - CommunityGenericContentTemplate.ascx is the control which uses this custom GenericContentDesigner;

    When I click 'Share this Content' on the custom Generic Content a new Shared content is created just fine, including the new fields. Now, if I select the shared content created above and I change, for e.g. the Heading and the Content, and Click "I'm done" the share content gets updated with the new Content, but the new Heading is not saved.

    The question I have is how can I update the shared content on the OnSaving event in CommunityDesigner.cs.

    Please let me know if you have any suggestion.

    Thank you for your help,

            /// <summary>      
            /// Executed automatically when the I'm done button is clicked in the Control Designer.      
            /// </summary> 
            public override void OnSaving()  
                // Set the underlying control properties to the new values.          
                ((CommunityGenericContent)DesignedControl).ContentHeadingPlaceholder.Text = Heading.Text.Trim();  
                ((CommunityGenericContent)DesignedControl).ImageID = ImageID.Text.Trim();  
                ((CommunityGenericContent)DesignedControl).ContentImageURLPlaceholder.ImageUrl = GetUrl(ImageID.Text.Trim());  
                if (ImageID.Text.Trim() != string.Empty)  
                    ((CommunityGenericContent)DesignedControl).ImageVisibility = true;  
                    ((CommunityGenericContent)DesignedControl).ImageVisibility = false;  
                //ISSUE == how to update the new fields in the shared content  
                //if (this.DesignedControl.SharedContent != null)  
                //    ContentManager contentManger = new ContentManager();  
                //    IContent cnt = contentManger.GetContent(this.DesignedControl.ContentID);  
                //    cnt.SetMetaData("Heading", Heading.Text.Trim());  
                //    cnt.SetMetaData("ImageID", ImageID.Text.Trim());  
                //    contentManger.SaveContent(cnt);  
                // clear ViewState values  
                this.ViewState["Heading"] = null;  
                this.ViewState["ImageID"] = null;  

    I have logged a support ticket, so you may ignore this post.


  2. Ivan Dimitrov
    Ivan Dimitrov avatar
    16072 posts
    12 Sep 2017
    16 Sep 2009
    Link to this post
    Hi Elena,

    We will get back to you in the support ticket. Just to let you know, before sending more detailed information you are treating the metakeys as properties and that is the problem.

    Ivan Dimitrov
    the Telerik team

    Instantly find answers to your questions on the new Telerik Support Portal.
    Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
2 posts, 0 answered