I created a very simple custom webpart which is modified by a very simple custom editor.
I am using the same web part on one page several times in an attempt to improve administration....
When I click apply / ok my changes seem to be made without a problem.
However, when I edit another instance (ie. change CustomPart1 and save and then go to change CustomPart2) the changes for the first instance (CustomPart1) are lost.
Any ideas?
public override bool ApplyChanges( )
{
ProductObject product = new ProductObject( );
product.BodyText = txtBody.Text;
product.HeaderText = txtHeader.Text;
product.ImageUrl = txtImageUrl.Text;
product.NavigateUrl = txtNavigateUrl.Text;
ProductPart.Update( product );
return true;
} public void Update( ProductObject p )
{
this.SetPersonalizationDirty( );
this.Product = p;
CreateChildControls( );
} void IPersonalizable.Load( PersonalizationDictionary state )
{
PersonalizationEntry pe = state[ "Test" ] as PersonalizationEntry;
if( pe != null )
{
this.Product = ( ProductObject )pe.Value;
}
}
void IPersonalizable.Save( PersonalizationDictionary state )
{
PersonalizationEntry entry = new PersonalizationEntry( this.Product, this.WebPartManager.Personalization.Scope );
state[ "Test" ] = entry;
}