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

Forums / Developing with Sitefinity / Method attributes in controls

Method attributes in controls

2 posts, 0 answered
  1. Al
    Al avatar
    33 posts
    Registered:
    28 Dec 2008
    30 Jul 2010
    Link to this post
    Hi there,

    I dont think this is specific to Sitefinity, but does anyone know of a way of creating a caption/name attribute for properties so that our content editors are presented with captions such as "Select image" rather than the actual property name such as "imageUrl".

    I've developed a custom control, which has a property such as:

    //private properties
        private string _sectionHeading;
        private string _sectionImageUrl;
        private string _sectionHyperlink;
     
        [Category("Content")]
        [Description("Heading i.e. Service 1")]
        public string sectionHeading {
     
            get {
     
                if (String.IsNullOrEmpty(_sectionHeading)) {
                    return "None provided";
                }
                return _sectionHeading;
     
            }
     
            set {
     
                _sectionHeading = value;
     
            }
     
        }

    Which i'd rather the user was presented with a field that has a caption/label of "Section Heading" rather than sectionHeading.

    Any ideas?

    Thanks in advance
    higgsy
  2. Al
    Al avatar
    33 posts
    Registered:
    28 Dec 2008
    30 Jul 2010
    Link to this post
    Hi all,

    Please ignore me, that way to do it is to set the [DisplayName("Enter friendly label here")] attribute.

    higgsy
2 posts, 0 answered