Don't miss out Virtual Happy Hour this Friday (April 26).

Try our conversational search powered by Generative AI!

IDynamicContent.Properties

Vote:
 

I have some trouble making my Dynamic Content control remembering the property setting that the user chooses when creating the control in the editor with the {} button. The "add" window pops up and gives me the dafault values I have set programatically, but as soon as I press "OK" and then pop up the same dialog again, the new values are gone, being replaced by the default values.

This my Properties property method:

public EPiServer.Core.PropertyDataCollection Properties {
get
{
return _props;
}
set
{
_props = value;






}
}

I guess there is something wrong here - but I cannot find any examples showing the use of more than one property.

#24629
Oct 02, 2008 12:50
Vote:
 

Hi Dag!

Actually the Properties collection will not store any state, it will only take care of the rendering of the PropertyData contained in it. You will be responsible for storing and loading the state yourself, using the State property in IDynamicContent.

Basically, what you need to do is to fetch the data from Properties in the get part of the State accessor and save it in the state string. Then you would need to, in the set part, refill the Properties collection with the values from the state string.

Here is a link to a more detailed guide on how you can work with the settings for dynamic content.

http://sdk.episerver.com/library/cms5/Developers%20Guide/How%20To/Create%20Dynamic%20Content.htm

Regards

Per Gunsarfs
EPiServer CMS development team

#24638
Oct 02, 2008 16:23
Vote:
 

Thank you, Per - that answer my question extremely well :)

 

#24721
Oct 06, 2008 9:37
* You are NOT allowed to include any hyperlinks in the post because your account hasn't associated to your company. User profile should be updated.