Help with CustomEditor

Last post 05-13-2008 12:55 PM by mpaterson. 1 replies.

Sort Posts:

  • Help with CustomEditor

    05-13-2008, 10:48 AM
    • Loading...
    • mpaterson
    • Joined on 11-26-2006, 10:24 PM
    • St. Petersburg, Florida
    • Posts 977

    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;
            }
     
    If everything happens for a reason what is the reason for this error?
  • Re: Help with CustomEditor

    05-13-2008, 12:55 PM
    • Loading...
    • mpaterson
    • Joined on 11-26-2006, 10:24 PM
    • St. Petersburg, Florida
    • Posts 977

    Nevermind I figured it out.
    It had to do with the PersonalizationScope.

    If everything happens for a reason what is the reason for this error?
Page 1 of 1 (2 items)