AfterDeserialize Method
The AfterDeserialize method of the WebPart class is the virtual function that is called after a Web Part's properties are deserialized from the SharePoint database or from a Web Part description file (.dwp). Suggested place for Web Part upgrade code.
Remarks
The AfterDeserialize method supports upgrade scenarios where a new version of a Web Part needs to accommodate changes to properties that have been saved for a previous version of a Web Part. If a Web Part developer simply adds one or more new properties, no upgrade logic is required. However, if properties are deleted, renamed, or the values saved are changed, then overriding the AfterDeserialize method provides a way for handling these changes when a Web Part is upgraded.
Example
The following code example shows an example of how to handle when one or more properties have been removed from the later version of a Web Part. Since elements which the assembly cannot recognize will be added to the UnknownXmlElements collection, the following code sample is an example of iterating through that collection and removing the unknown elements.
For more information on using the AfterDeserialize method when upgrading Web Parts, see "Upgrading a Web Part Assembly" at http://msdn.microsoft.com/sharepoint.
Requirements
Platforms: Windows Server 2003
Security: Code Access Security