Custom LongString property won't save

Member since: 2008


I've been trying to save some string data (serialized xml) to a custom property that i've implemented as follows:a

public class MyProperty : EPiServer.Core.PropertyLongString
public MyData MyData
{return (MyClass)this.LongString;}

this.Longstring = value.ToString();
// LongString = "Even tried with a this hardcoded string";
I create a new page with DataFactory.Instance.GetDetfaultPageData(...) 
then set the custom propery with 
MyProperty propData = new
propData.MyData = salon;
page.Property["MyProperty"] = propData;
and finally call 
DataFactory.Instance.Save(page, EPiServer.DataAccess.SaveAction.Save | EPiServer.DataAccess.SaveAction.Publish); 
The problem is that  the page saves but the propertydata does not. In debug mode just befor page.Save() I can see that the custom property is set and the PageData does contain it. But nothing gets written to the database! Why?
If i go into Edit mode and manually fill in a text there the value is saved as normal.
Has anyone had similar issues? Any ideas on why this happens? Have i missed implementing some vital method? (i only implement the get/set since i assume ProperyLongString implements all methods required by IPropertyData)
#28473 Mar 10, 2009 11:39
  • Per Bjurström
    Member since: 1999
    MyProperty propData = page.Property["MyProperty"] as MyProperty;
    propData.MyData = salon;
    #28482 Mar 10, 2009 20:11
    #50767 May 12, 2011 9:55
    #50768 May 12, 2011 9:58
    I have the same issue ,

    Please provide help ASAP.

    I followed those examples:

    Also consulted those:


    I use EPiServer CMS 5 R2 SP2,

    I generate controls dynamycally and I have list of boxes that I can fill with values, and when I save things are saved normally, but when I click on remove button on my control it successfully removes and updates the property (removing one itom from list) and setting new changed list to the property. I also call these to force save function:

    PropertyInfoBox myProp = CurrentPage.Property["InfoBoxes"] as PropertyInfoBox;
    if (myProp != null)
    //myProp.InfoBoxSummary = newSet.CreateWritableClone();
    myProp.Value = newSet.ToString();
    DataFactory.Instance.Save(CurrentPage, EPiServer.DataAccess.SaveAction.Save);

    //Force to save changes
    base.ApplyChanges();//calls ApplyEditChanges
    and in ApplyEditChanges I call in the end:

    this.PropertyData.Value = propertyValue.CreateWritableClone();
    this.PropertyData.IsModified = true;

    propertyValue.IsModified = true;

    In all stages my property is being set to new values I made, BUT when I click on Save button i Edit Mode in CMS it shows the old value and tht is the problem!

    Why is that ? what is wrong ?

    Please provide support ASAP.
    #50769 May 12, 2011 10:00

    Here you can find simple project to reproduce the issue:


    You simply add it to any of your project and add that property to one of pages, it is simple text box control which has one button near it. Inside button  event, text is being changed then saved the value of property. But on next click of the same button OR Save and Publish button you will notice that in CreateEditControls it gets back /fills with old values (before modification).

    The pitty part is that its not possible to debug the EPiServer.dll coz Debug Symbols are not provided by EPiServer at their given address ,  even I read many articles about it.

    #50854 May 16, 2011 8:55
  • Paul Kennett
    Member since: 2007

    Did you ever get a resolution to this Ulf?

    #87039 Jun 09, 2014 4:34