Try our conversational search powered by Generative AI!

Custom LongString property won't save

Vote:
 

Hi,

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

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

set{
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
Vote:
 
 
MyProperty propData = page.Property["MyProperty"] as MyProperty;
if(propData!=null)
{
propData.MyData = salon;
}
#28482
Mar 10, 2009 20:11
Vote:
 
#50767
May 12, 2011 9:55
Vote:
 
#50768
May 12, 2011 9:58
Vote:
 
I have the same issue ,

Please provide help ASAP.

I followed those examples:

http://joelabrahamsson.com/entry/creating-a-custom-episerver-property-with-a-custom-class-as-value#comment866

Also consulted those: http://world.episerver.com/Articles/Items/Creating-custom-properties-in-EPiServer-CMS-5/

and http://world.episerver.com/Modules/Forum/Pages/thread.aspx?id=33667



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;
SetValue(propertyValue);


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
Vote:
 

Here you can find simple project to reproduce the issue: 

http://cid-6ed48db4c81844b4.office.live.com/self.aspx/Public/UploadsForOthers/GenericLib.zip

 

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 symbols.episerver.com ,  even I read many articles about it.

#50854
May 16, 2011 8:55
Vote:
 

Did you ever get a resolution to this Ulf?

#87039
Jun 09, 2014 4:34
This thread is locked and should be used for reference only. Please use the Episerver CMS 7 and earlier versions forum to open new discussions.
* You are NOT allowed to include any hyperlinks in the post because your account hasn't associated to your company. User profile should be updated.