How did you convert your dynamic property to a "static" property? As I understand you want to convert both the property definition and move the value from dynamic to static?
We did face a similar problem, we wrote some code that went through all dynamic properties and created them as static properties. When the static property were created we copied the value from the dynamic property to the static property through code.
I've tried to change 2 things directly into the SQL table:
tblProperty table - changed the fkPageId to point to my new custom property page id
tblPageDefinition - changed the fkPageTypeId from null which I believe identified a dynamic property
As far as I can see the properties have moved to 'static' properties and now sit on my custom page but none of the values show.
Even through admin mode the properties show in the list on the page. Somehow I've removed the link to the property value or broken it
but cant identify how....
Cheers
Ben
I would strongly recommend not to do this directly against the database. Use EPiServers API instead!
Yeah I was coming around to that possibility. Can you advise which API as a starting point?
EPiServer.DataAbstraction.DynamicProperty (get dynamic properties and values related to a page)
EPiServer.DataAbstraction.PageDefinition (add and save properties to a pagetype)
EPiServer.DataAbstraction.PageType (to load and save pagetypes )
I can mail you some code that might help?
Hi,
I've got some code and I'm able to move a dynamic property to a static property but only on the same page. 2 things I'm struggling to do in the code are:
1. Delete the existing dynamic property (not required now its been converted to a static one)
2. Move the newly created static property to a new page altogether
Cheers
Ben
1. Think you can use PageDefinition.Delete method. And the resave the pagetype, give it a try.
http://sdk.episerver.com/library/CMS5/html/Methods_T_EPiServer_DataAbstraction_PageDefinition.htm
Something like this:
2. Why not create the static properties at correct page from start? Otherwise you can do the same thing as you did with when copying dynamic to static.
Why delete the dynamic properties by code? Just delete the through the admin gui. Quicker than doing it by code maybe?
Hi,
1. This is true but I thought if I was going to the trouble to copy them to static why not remove at the same time and do it all in one job. WIll have a look at the exmaple code above.
2. Yes this is what I've been trying to do without success so far. I've only been able to create them on the same page todate. Maybe my explanation wasnt accurate enough.
Will persevere...........
Hi,
I have created one Dynamic propery for SiteConfiguration of type page and i want to set it common for all pages. How and where can i set it EpiServer7.5?
Or is there any other way to set comon configuration page for all pages?
The general approach is to create a site settings section on your StartPage type, and access the property values directly through the StartPage. You could also create the site settings in a separate page under the Root, or use a block to hold all the properties. There's many approaches you can take; it's just a matter of preference.
My preferred method these days is a customized version of Alf Nilsson's SettingsRepository: http://talk.alfnilsson.se/2014/04/01/creating-modular-settings-with-blocks/
(As a side note: For EPiServer 7.5+ questions, please create a new thread in the EPiServer 7.5 section, instead of bringing up old EPiServer CMS 5 R2 threads.)
I'm trying to convert 400+ dynamic properties located on the start page to be standard page properties assigned to a custom global properties page setup solely to contain these properties. I believe this may aid my site performance due to the hit of going up to the top home page to retrieve these properties.
Anyhow I've been looking at the database table structures namely tblProperty and tblpagedefinition. I've moved a property from being a dynamic property on the home page to be a property on my custom global properties page. However the value against the property no longer shows through the edit UI and is blank. The row still exists within the database.
Any ideas? P.S. yes I've taken a backup first of my database.