More in this section
Forums / Designing with Sitefinity / How to display custom label which contains the description of a property

How to display custom label which contains the description of a property

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. eraashishgupta
    eraashishgupta avatar
    50 posts
    26 Nov 2008
    23 Jan 2009
    Link to this post
    I want a label to display some message after a property which is both getter and setter.
    This label is just like the description attribute which is represented by default as ? in front of the property name.
    I just want to have that description as a label next to the property text box so that its more user friendly as my client is not so technical he might not spot out the ?

    So is there a  way to do this.
    I just want [Description("")] attribute to be displayed in a label next to my property in a particular user control.

    Or is there a way to just display the label inside the admin section for a particular user control only.

  2. Ivan Dimitrov
    Ivan Dimitrov avatar
    16072 posts
    12 Sep 2017
    23 Jan 2009
    Link to this post

    Here is a simple example that will return the description of a give property when click event is fired. This should be implemented for your approach.

        [Description("here is my desc")] 
        public string Desc 
            get { return desc; } 
            set { desc = value; } 
        private string desc; 
        protected void Page_Load(object sender, EventArgs e) 
        protected void Button1_Click(object sender, EventArgs e) 
            System.ComponentModel.AttributeCollection attributes = TypeDescriptor.GetProperties(this)["Desc"].Attributes; 
            DescriptionAttribute myAttribute = (DescriptionAttribute)attributes[typeof(DescriptionAttribute)]; 

    All the best,
    Ivan Dimitrov
    the Telerik team

    Check out Telerik Trainer, the state of the art learning tool for Telerik products.
2 posts, 0 answered