Try our conversational search powered by Generative AI!

Selected/not selected dynamic property always inheriting its value from above

Vote:
 
Hi All I have a dynamic property of the type "Selected/not selected" which goverens whether a particular box appears on a page. It appears that if it isn't checked, it inherits the checked value from its parent. Is there any way to stop this behaviour? It seems crazy, as there are bound to be situations where you want to say "No, don't do it on this page." Cheers, Dan
#13118
Jul 13, 2007 16:36
Vote:
 
The "problem" is obvious, if a property doesn't have a value in episerver it's NULL, and if a dynamic property is NULL then it inherits the value. Because an unchecked box is null (in episerver), it gets inherited. The reason why it behaves this way is obvious, why it's implemented this way is what confuses me. When you need an "on-off" dynamic property you can either make your own property which handles this, or if you're lazy, use an integer property instead where "<= 0" is off and "> 0" is on. // Björn Sållarp Avantime AB
#15444
Jul 16, 2007 13:29
Vote:
 

Surely if fields that inherited their value were prepopulated in the UI then not only would it solve this problem but it would also be much less confusing for the user.

So in other words, if the checkbox was selected in a parent page, then it would also be selected when you view that property in a child page. Then if you chose to deselect it the CMS could clearly see that the value needed to be reset on that page.

#19891
May 13, 2008 16:29
Vote:
 

As stated, dynamic properties are always inherited unless they are set at the current page. This is shown in the UI next to the property (*=set at the current page, ^=inherited, ?=undefined). Hovering the indication will provide you with a tool tip saying where it's inherited from.

If you need to check if the dynamic property is set or not set at the current page, you can access it programaticly and first use .IsDynamicProperty (if you need to verify) and then use:

PropertyBoolean pb = CurrentPage.Property["bool"] as PropertyBoolean;
if (pb.IsDynamicProperty)
{
DynamicProperty dp = DynamicProperty.Load(CurrentPageLink, "bool");
dp.InheritedPageLink //source page

InheritedPageLink can be used to check if the value is set at the current page or not.

 

#19917
May 14, 2008 14:22
Vote:
 

I'm aware of that. But is there a good reason why this over complicated unintuiitive system is used? 

#19945
May 16, 2008 11:48
Vote:
 

I can't say why things are the way they are, but I guess you could workaround the current design by building a custom property instead of the built-in bool (selected/not select). The bool in EPiServer does only store it's value if it is set (true). I guess it's built the way it is to limit entries in the database.

You could however build a custom property that inherits from PropertyString and use a checkbox for rendering. That would allow you to store as many values you'd wish (e.g: true, false, not selected) and render it like a checkbox used when setting access rights in Windows (can be selected, not selected or show up as grey when inherited).

#20068
May 20, 2008 11:45
Vote:
 

I think that this is pretty strange too, that EpiServer doesnt support any easy-to-do solution for this. If you have 999 out of a 1000 childpages that you want to inherit a property, you shouldn't use a dynamic property for this? That just screams wrong to me :)

 

/Mats

#26979
Jan 12, 2009 16:04
Vote:
 
My solution to this which is a solution I've seen many come to, is to create a custom property using a dropdownlist with three values. Yes, No and Inherit.
#26980
Jan 12, 2009 16:49
Vote:
 

An even better solution is to have 5 values.

  1. Yes
  2. No
  3. Inherit
  4. Children Yes, me No
  5. Children No, me Yes

Guess the option values text could be betterEmbarassed

#26981
Jan 12, 2009 19:54
* 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.