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

Forums / Developing with Sitefinity / Sitefinity 3.6: How to add Custom Fields to Existing Sitefinity Modules

Sitefinity 3.6: How to add Custom Fields to Existing Sitefinity Modules

11 posts, 0 answered
  1. Sharad Sinha
    Sharad Sinha avatar
    9 posts
    Registered:
    29 Jul 2009
    11 Sep 2009
    Link to this post
    Hi,

    I'm using Sitefinity 3.6 (Community edition) and trying to add Custom Fields to Existing Sitefinity Modules.
    After searching, I saw the webinar addressing the issue and the corresponding notes on
    http://www.sitefinitywatch.com/blog/09-01-15/Adding_Custom_Fields_to_Existing_Sitefinity_Modules.aspx

    But I guess this addresses an older version of Sitefinity as I couldn't find the control templates referred in the webinar
    eg.
    ~/Sitefinity/Admin/ControlTemplates/Events/ControlPanelInsert.ascx
    ~/Sitefinity/Admin/ControlTemplates/Events/ControlPanelEdit.ascx
    don't exist
    Instead there is a ContentVersionView.aspx in the mentioned path ~/Sitefinity/Admin/ControlTemplates/Events/
    Can you please provide the version specific help. Is adding custom fields to existing modules allowed in the Community edition?

    Thanks in advance.
    Sharad
  2. Ivan Dimitrov
    Ivan Dimitrov avatar
    16072 posts
    Registered:
    16 Jun 2017
    11 Sep 2009
    Link to this post
    Hi Sharad Sinha,

    You should map the external templates for the desired modules. For more detailed information please take a look at How to map a view.

    Best wishes,
    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.
  3. Sharad Sinha
    Sharad Sinha avatar
    9 posts
    Registered:
    29 Jul 2009
    11 Sep 2009
    Link to this post

    Thanks Ivan,

     

    I've been waiting impatiently for any answers :) . Let me go through the link and get back.

     

     

    Thanks again

    Sharad

  4. Joe
    Joe avatar
    6 posts
    Registered:
    04 May 2009
    19 Dec 2009
    Link to this post
    I followed the instructions in the link you provided however when trying to add another meta field to the Libraries module the text I enter into the field does not save.

    Example:
    1. I added a key for Libraries in web.config called "ImgDescription".
    2. I added a textbox in LibraryItemEdit.ascx with an id of "ImgDescription".
    3. I also added a label with the text value of "<%$Resources:ItemEdit_ImgDescription %>"
    4. I added a corresponding resource to LibraryItemEdit.resx
    5. I mapped a view to the ascx file per Georgi's instructions.
    6. Restarted application.

    The ImgDescription field appears on the ItemEdit page, but it does not save.

    What am I missing?  Thanks. Joe.
  5. Ivan Dimitrov
    Ivan Dimitrov avatar
    16072 posts
    Registered:
    16 Jun 2017
    20 Dec 2009
    Link to this post
    Hi Joe,

    If the metakey has not been registered in the section below of Sitefinity's web.config file ( it should be added in in metakeys attribute) you may experience the problem you describe.

    <libraryInfo>
                    <add name="Image" title="Image Library" defaultExtenstions=".png, .jpg, .jpeg, .gif" metaKeys="LinkUrl,Author, AlternateText, Extension, Name, Height, Width, Size, Category"></add>
                    <add name="Document" title="Document Library" defaultExtenstions=".doc, .docx, .rtf, .txt, .pdf, .ppt, .pps, .pptx, .html, .xls, .xlsx" metaKeys="Author, Description, Extension, Name, Size, Category"></add>
                    <add name="Custom" title="Custom Library" defaultExtenstions=".*" metaKeys="Author, Description, Extension, Name, Size, Category"></add>
                    <add name="Video" title="Video" defaultExtenstions=".wmv, .flv" metaKeys="Author, Extension, Name, Size, Category, Description"></add>
                    <!-- Viddler can co-exists with other libraries-->
                    <!--<add name="Viddler" title="Viddler Library" defaultExtenstions=".avi, .mpg, .mov, .wmv, .wma, .3gp" metaKeys="Author, Description, Extension, Name, Size, Category"></add>-->
                </libraryInfo>

    Also make sure that you have declared the metakey under ContentMetaFields control.

    All the best,
    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.
  6. Joe
    Joe avatar
    6 posts
    Registered:
    04 May 2009
    21 Dec 2009
    Link to this post
    That was it!  I added the metaFields key but not the libraryInfo metaKey.

    Thanks Ivan.

    Joe
  7. Joe
    Joe avatar
    6 posts
    Registered:
    04 May 2009
    21 Dec 2009
    Link to this post
    Hi Ivan,

    If I may, one more question.  How would I go about retrieving a specific image and it's corresponding metafields?  I have searched the forums and found where the metadata is stored (GCMetaData), but the id of each item seems to be related to the library guid located in '..BinaryContent'.  I only have 1 library with 10 images.  It appears all 10 images are stored as a single BinaryData entry in the 'ContentValue' column that corresponds to the guid's of each metafields in the 'GCMetaData' .

    If this is the case how can I query a specific image(s)?  I tried the binaryimage control from the demos.telerik site but was unsuccesful.  The metafields are no problem, but I can't get the image to dispaly in a databound type control.

    Thanks for any help you can offer.

    Joe
  8. Ivan Dimitrov
    Ivan Dimitrov avatar
    16072 posts
    Registered:
    16 Jun 2017
    21 Dec 2009
    Link to this post
    Hi Joe,

    You need to access the content item and then use GetMetaData method.

    sample code:

    LibraryManager LManager = new LibraryManager("Libraries");
    ILibrary library = LManager.GetLibrary("Image");
    IList allLibraryItems = library.GetItems();
    if (allLibraryItems.Count > 0)
    {
        foreach (IContent cnt in allLibraryItems)
        {
            string metadata = (string)cnt.GetMetaData("Name");
            Response.Write(metadata + "<br />");
        }
    }

    You can gather more information at Images and Documents API Overview, Finding Content Items

    Kind regards,
    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.
  9. Omnia Development
    Omnia Development avatar
    4 posts
    Registered:
    29 Jan 2007
    24 May 2010
    Link to this post
    Hi,

    I'm using SF 3.7 SP2 and I am trying to add a Thumbnail field to the Blogs module, I have followed all the instructions on Sitefinitywatch.com ie modifying webconfig and templates but the values aint saving in the database, though I do see my custom field appear in the database but value is empty (not null)

    PFA the screenshots of my project and DB.

    Can you please help me.

    Thanks,
  10. Ivan Dimitrov
    Ivan Dimitrov avatar
    16072 posts
    Registered:
    16 Jun 2017
    24 May 2010
    Link to this post
    Hello Zubair,

    Please check whether you have added the TextBox inside the default ContentMetaFields control. If the TextBox is outside of ContentMetaFields the values are not persisted automatically.

    Regards,
    Ivan Dimitrov
    the Telerik team

    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.
  11. Zubair
    Zubair avatar
    142 posts
    Registered:
    26 Dec 2007
    25 May 2010
    Link to this post
    Awesome it works after putting it in ContentMetaFields control, guess I didnt pay attention to the screencast (because I couldnt full screen it, please check) also its not shown anywhere on the Sitefinitywatch.com post.

    One problem I had was that I needed to use RadWindow for allowing uploads, so I wrapped the whole thing in a UserControl and implemented ITextControl interface like this,
    public string Text
        {
            get
            {
                return this.Thumbnails.Text;
            }
            set
            {
                this.Thumbnails.Text = value;
            }
        }

    where Thumbnails is my Textbox control whose value I need to save. Then I included this Usercontrol into the Contentmetafield and that was it :)
Register for webinar
11 posts, 0 answered