Show value of a inherit property in Edit mode
EpiServer have some cool features when it comes too properties and inherits. There are several ways the inherit can come from.
- If a page is on two languages, the not language depended fields from the master page will be inherit to the language specific page.
- If a page have specified Link type to “Fetch data from” null properties will inherit from the source page.
- Dynamic properties will inherit from the first parent that have a value set for a given property
When a editor are in edit mode on a page that have one or more of these inherits turn on the inherit field will be left blank, and the editor have to remember what the value is. That can be a bit tiresome.
I therefore make these properties too show the inherit value and made a popdown where the editor can change between inherit and set own value.
There are none easy way that I have found that I could use to make some changes to all properties that are displayed in edit modus, so I made myself a PlugIn that found the PropertyDataForm that EPiServer uses in the edit tab when they display the edit grid and changed it with my own.
I then had full control when the edit grid was displayed.
The dynamic edit display on the other hand was a bit more trickyer to hack. I ended up with adding a property that found all the other properties and added the dropdown with inherit or own value.
The actully logic is done in the class FixInherit.cs.
Code
have uploaded the code with http://paste2.org/. You need to make these files. Will maybe upload the complete prosject file later.
EditPageControlOwn.ascx.cs
this is the GuiPlugIn that will replace the PropertyDataForm with PropertyDataFormOwn
FixInherit.cs
This is the code that will find what the property could be if it was inherit, and will add a dropdown too a cell next to edit content.
PropertyFindOtherProperties.cs and PropertyFindOtherPropertiesControl.cs
This is the property that find the other dynamic properties. You need of course to add this property to your dynamic property list
PropertyDataFormOwn.cs
This is the coyy of ProperrtyDataForm that I needed to get from Refector. have added 2-3 lines
PropertyGetHandlerOwn.cs
This is some functions that exists but didnt return the right information.
27 January 2009