More in this section

Forums / Developing with Sitefinity / Administration of user controls

Administration of user controls

2 posts, 0 answered
  1. JR
    JR avatar
    1 posts
    Registered:
    21 May 2008
    30 May 2009
    Link to this post
    Hi

    I have created a user control (a banner) that has two properties (a title and a description). I uploaded the banner in the toolbox, drag-and-dropped it in one of my pages and I set up it's properties. Now that I am ready I want to drag-and-drop the same control (with the properties I set up) in other pages. But I can only drag-and-drop the control in another page and then set up it's propertes (enter the title and description) once again. Is there a way to set up the properties of a user control only once and then drag-and-drop it in every page? This would be something like "Administration for user controls" - a way to edit the properties of my uploaded user controls not page by page but for the whole web site.

    Regards,
    Yawor
  2. Ivan Dimitrov
    Ivan Dimitrov avatar
    16072 posts
    Registered:
    12 Sep 2017
    30 May 2009
    Link to this post
    Hi Joep Romijn,

    It is not possible to save the properties settings for the new control, because it is another instance. I suggest that you should use DefaultValue attribute. Thus, you will have default value for your property. It can be changed if you want to set something else.

    Here is a sample code:

     private bool myVal = false
     
        [DefaultValue(false)] 
        public bool MyProperty 
        { 
            get 
            { 
                return myVal; 
            } 
            set 
            { 
                myVal = value; 
            } 
        } 


    Regards,
    Ivan Dimitrov
    the Telerik team

    Instantly find answers to your questions on the new Telerik Support Portal.
    Check out the tips for optimizing your support resource searches.
2 posts, 0 answered