AI OnAI Off
This is my code that I am using:
var fileList = this.SliderPages;
string serializedString = string.Empty;
if (fileList.Count > 0)
{
using (MemoryStream tempMemory = new MemoryStream())
{
BinaryFormatter binaryFormatter = new BinaryFormatter();
binaryFormatter.Serialize(tempMemory, fileList);
serializedString = System.Convert.ToBase64String(tempMemory.ToArray());
}
}
DataFactory factory = EPiServer.DataFactory.Instance;
var data = factory.GetPage(this.CurrentPage.PageLink);
data.SetValue(this.PropertyName, serializedString);
factory.Save(data, EPiServer.DataAccess.SaveAction.Save);
This is the error I get:
Message = "The property SliderBox is read-only."
Before you can set new value. you need a writeable clone of the page data object:
var writablePage = data.CreateWritableClone();
Ìs it possible to override a readonly property and save it's new value using c# code?
I have an old custom property on my page that I need to be able to override and save new values to since the old code dosen't seem to work longer and save to.