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

Forums / Developing with Sitefinity / Controls and properties

Controls and properties

6 posts, 0 answered
  1. Matt
    Matt avatar
    20 posts
    Registered:
    17 Oct 2008
    18 Feb 2009
    Link to this post
    Hi

    I've a custom module I've created, lets say it's called 'CustomModule' ;), and I have a CustomModuleView control which is the implementation which gets placed in the page.

    I create a shared content item in the 'CustomModule' section and set various properties of 'CustomModule1', in my page I then add a new 'CustomModuleView', 'CustomModuleView1' and select 'CustomModule1' as the shared content,   'CustomModuleView1' takes on the properties of 'CustomModule1', all is well at this point! 

    My problems occur if I then  change some of the properties of 'CustomModule1', unfortunately the properties of 'CustomModuleView1' don't change! Updates to the content do work, just not the properties.

    Is this intended behaviour, to branch the properties?

    Is there a way to get these properties to be replicated from 'CustomModule1' to 'CustomModuleView1', (I'm hoping theres a property decorator I can set that will mark them for inheritance :D ?
  2. Bob
    Bob avatar
    330 posts
    Registered:
    30 Dec 2016
    24 Feb 2009
    Link to this post
    Hello Matt,

    I’m not sure if I understand the case correctly. Could you please send us example, your custom module controls?

    Kind regards,
    Bob
    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.
  3. Matt
    Matt avatar
    20 posts
    Registered:
    17 Oct 2008
    02 Mar 2009
    Link to this post
    Think I've spotted the problem, ( I spotted it while depersonalising the code to send it to you :) )

    my code is currently ..
    Category("Others")]  
    public string DateFormat  
    {  
        get 
        {  
            if (ViewState["DateFormat"] == null && this.SharedContent != null 
            && (this.SharedContent.Status == ContentStatus.Published || this.SharedContent is StagedContent))  
            {  
                ViewState["DateFormat"] = this.SharedContent.GetMetaData("DateFormat");  
            }  
            return ViewState["DateFormat"as string;  
        }  
        set { ViewState["DateFormat"] = value; }  
    It of course only looks for the shared property when it's viewstate property is null, on a saved control that had a readable value this will not be null, since the control properties will be saved at design time, hence at runtime it is never interogating the SharedContent metadata at runtime.

    thanks :)
  4. Ivan
    Ivan avatar
    478 posts
    Registered:
    16 Jun 2015
    02 Mar 2009
    Link to this post
    Hello Matt,

    we are glad that you were able to solve the problem. Let us know if there is anything else we can do for you.

    Kind regards,
    Ivan
    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.
  5. Matt
    Matt avatar
    20 posts
    Registered:
    17 Oct 2008
    02 Mar 2009
    Link to this post
    Thanks Ivan

    fyi changing the code to
     
     
    [Category("Others")]  
    public string DateFormat  
    {  
        get 
        {  
            if (this.SharedContent != null && (this.SharedContent.Status == ContentStatus.Published || this.SharedContent is StagedContent))  
        {  
            return this.SharedContent.GetMetaData("DateFormat"as string;  
        }  
        else 
        {  
            return ViewState["DateFormat"as string;  
        }  
        }  
        set { ViewState["DateFormat"] = value; }  

    gave me the desired behaviour
  6. Ivan
    Ivan avatar
    478 posts
    Registered:
    16 Jun 2015
    02 Mar 2009
    Link to this post
    Hello Matt,

    nice going :).

    Greetings,
    Ivan
    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.
Register for webinar
6 posts, 0 answered