More in this section
Forums / Developing with Sitefinity / Binding custom fields to certain Content items

Binding custom fields to certain Content items

The forums are in read-only mode. In case that you want to directly contact the Progress Sitefinity team use the support center. In our Google Plus group you can find more than one thousand Sitefinity developers discussing different topics. For the Stack Overflow threads don’t forget to use the “Sitefinity” tag.
2 posts, 0 answered
  1. Thomas
    Thomas avatar
    223 posts
    19 Jan 2011
    08 Jun 2011
    Link to this post

    I have a widget that creates classifications if they do not already exist.
    I'd like to know how to programmatically bind these classifications to Document & Files, so they appear there (when creating and editing elements), in the same way they do when doing it manually in the backend, through Content > Document & Files > Custom Fields.

  2. Ivan Dimitrov
    Ivan Dimitrov avatar
    16072 posts
    12 Sep 2017
    10 Jun 2011
    Link to this post
    Hi Thomas,

    In edit and new screen of an item we use ContentViewSectionElement and inject HierarchicalTaxonFieldDefinitionElement


    public static HierarchicalTaxonFieldDefinitionElement CategoriesFieldWriteMode(ConfigElement section)
        return new HierarchicalTaxonFieldDefinitionElement(section)
            ID = "categoriesFieldControl",
            DataFieldName = "Category",
            DisplayMode = FieldDisplayMode.Write,
            ResourceClassId = typeof(TaxonomyResources).Name,
            TaxonomyId = TaxonomyManager.CategoriesTaxonomyId,
            WebServiceUrl = "~/Sitefinity/Services/Taxonomies/HierarchicalTaxon.svc",
            AllowMultipleSelection = true,
            WrapperTag = HtmlTextWriterTag.Li,
            Title = "Categories",
            ExpandableDefinitionConfig =
                Expanded = false,
                ExpandText = "ClickToAddCategories",
                ResourceClassId = typeof(TaxonomyResources).Name

    As for the custom fields

    - you can add them through custom fields dialog ( check attached screenshot cf1)
    - default fields can't be deleted or edited. There is a service that checks default and custom fields and there are separately bound. As you can see even categories and tags are put the in the custom fields section. So you have to add your custom control through the UI dialog.

    Kind regards,
    Ivan Dimitrov
    the Telerik team
    Do you want to have your say in the Sitefinity development roadmap? Do you want to know when a feature you requested is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
2 posts, 0 answered