Design Time Serialization

  • November 2019
  • PDF

This document was uploaded by user and they confirmed that they have the permission to share it. If you are author or own the copyright of this book, please report to us by using this DMCA report form. Report DMCA


Overview

Download & View Design Time Serialization as PDF for free.

More details

  • Words: 251
  • Pages: 2
Design Time Serialization: 26.1 Why doesn't my properties tagged with the PersistenceMode.InnerProperty attribute get saved in the aspx file?

All string type properties get saved as attributes of the parent tag inspite of the InnerProperty attribute setting. In fact, setting the InnerProperty attribute might prevent the property from getting saved at all.

For example, in the property declaration below:

[C#] [ Category("Appearance"), NotifyParentProperty(true), PersistenceMode(PersistenceMode.Attribute), // This should always be Attribute, not anything else like InnerProperty. ] public string Text{get{return text;}set{text = value;}}

26.2 Why doesn't changes made to some of my properties don't get saved in the aspx file during design time?

Nested properties in your controls should be marked with the NotifyParentProperty(true) attribute in order for the designer to get notified that it's value has changed.

For example, the following property (SubProperty) declaration should include the above mentioned attribute, for the designer to persist changes to that property during design-time:

myControl.SomeComplexProperty.SubProperty = "some value";

26.3 Why doesn't my Collection Properties get saved in the aspx file properly during design-time?

Some common mistakes that will cause the designer to choke while persisting collection properties are:

The corresponding collection type cannot have multiple (overloaded) indexers. You should always define a single indexer of the type "public SomeType this[object obj]{...}". Otherwise the changes will be persisted but the control will not load in the designer. You will see a "Ambiguous match found" error. If the colleciton property has the PersistenceMode attribute set to InnerProperty then the property should not include a set

method.

Related Documents

Design Time Serialization
November 2019 2
Serialization
November 2019 2
Object Serialization
June 2020 4
Xml Serialization
November 2019 4