PropertyData has a property named IsDynamicProperty so you can check that. However, I don't know if it is set correctly when a new page is being created, you'll have to try it. Good luck!
While fetching the values I am making use of IsDynamicProperty property. But the data saved needs to be showed in a different way under dynamic properites and edit mode. Fot this I need to differetiate in a different way.
I don't see how this is a problem, but perhaps I'm not getting the full picture. Your IPropertyControl implementation has access to it's connected PropertyData which ahs the IsDynamicProperty property. So you should easily be able to render the control differently depending on the value of this property.
For a page my custom property is added as a pagetype property as well as a dynamic property. This property is bascially a dropdown with multi select. Now the editor sets few values under dynamic properties and few values under pagetype property in edit mode. Now in edit mode while editing the page I have to show the values set in dynamic property as disabled. I have the below method for that.
if (IsInheritedLocation(location.PageLink.ID))
{
li.Attributes.Add("disabled", "true");
}
Problem is, now if the editor checks under dynamic properties even there the option will be disabled. SO int he above method before applying "disabled attribute" I will have to check where this property id being rendered.
How do you read the dynamic property value from within the IPropertyControl? I mean, if you are editing a dynamic property this would be the IPropertyControl.PropertyData, but if you are editing a page property that would be the page property and the dynamic property value defined for the page is nowhere to be found?
In the associated Control file I get page property and from the main control I get the dynamic property value.
I have the below code in associated Control.
var p = EPiServer.DataFactory.Instance.GetPage(currentPageLink).Property["dynamicpropertyname"];
if (p != null && p.IsDynamicProperty)
l = (p as PropertyMultipleSelection).GetSelectedLocationIDs();
GetSelectedLocationIDs() just takes the values from IPropertyControl. This method I have in main control.
I solved this issue by deriving from 'PropertyLongString' now.
Hi,
I have a custom property which is deriving from 'PropertyString'. property cs file how can i differentiate if the editor is accessing this property from Dynamic properties or from page edit mode.
I have one more custom property which is deriving from 'PropertyLongString' there I am differentiating as below.
private bool IsSettingsProperty
{
get
{
return EditorToolOptions == ~EPiServer.Editor.EditorToolOption.All;
}
}
Based on what the above method returns I am differentiating. I can't use the above when deriving from 'PropertyString'. Please suggest