PropertyList changes not detected

Vote:
 

I really like the new PropertyList in EPiServer. There is a great blog post by Per Magne Skuseth on how to use it with simple classes.

I used Per's code as an example but I ended up with some strange behaviour (yeah yeah, it's beta code I know)

In the UI I can add and remove entries to the list and then publish the changes, this works fine. However when I try to modify entries in the list, changes are not detected. (Try changing the age of a person)

Same goes for modifying entries from code.

var clone = currentPage.CreateWritableClone() as StartPage;

clone.Contacts[0].Age = 150; //Very old guy

_contentRepository.Save(clone, SaveAction.Publish, AccessLevel.NoAccess);

No change is stored in the database, nothing is published.

Debugging learned me that IsModified on the PropertyList is always false. How do I get my changes detected? 

Thanks,
Mark

#142411
Dec 10, 2015 15:37
Vote:
 

In the latest update of Episerver CMS modifications of a PropertyList entry in the edit UI are detected, so I can publish my changes there

However when I change a PropertyList entry from code changes are not detected.

Is this a known issue? Am I doing something wrong?

#142794
Dec 24, 2015 15:25
Vote:
 

Hi,

I think that you need to ass the whole list, not just the property of the list. So instead of clone.Contacts[0].Age = 150; you need to execute:

clone.Contacts[0].Age = 150;
clone.Contacts = clone.Contacts;

I think that mark property as IsModified should also work:

clone.Property["Contacts"].IsModified = true;

 

#142806
Dec 29, 2015 18:48
Vote:
 

Thanks a million Grzegorz!!

clone.Property["Contacts"].IsModified = true;

did the job!

#142810
Dec 29, 2015 21:49
This topic was created over six months ago and has been resolved. If you have a similar question, please create a new topic and refer to this one.
* 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.