Back office editor to load code altered data rather than just from db
I have a requirement where I need to encrypt my page field data using the Document.BeforeSave from the back office. this is fine and it works, but I cant find any events to place my decrypt code so the backoffice can load the data back for the user to edit.
I've tried ContentControl.AfterContentControlLoad where I can access the field, decrypts but the editor doesnt show the decrypted content. Can anyone advise how to solve or is there a better way to encrypt/decrypt data that is readable in the back office ?
public void Content_AfterLoad(ContentControl sender, umbraco.controls.ContentControlLoadEventArgs e) { if (sender.ContentObject.getProperty("childName")!=null){ Document doc = new Document(sender.ContentObject.Id); // following two lines correctly decrypt field but the backoffice editor doesnt show updated content doc.getProperty("childName").Value = Decryption(doc.getProperty("childName").Value.ToString()); sender.ContentObject.getProperty("childName").Value = Decryption(doc.getProperty("childName").Value.ToString()); }
Back office editor to load code altered data rather than just from db
I have a requirement where I need to encrypt my page field data using the Document.BeforeSave from the back office. this is fine and it works, but I cant find any events to place my decrypt code so the backoffice can load the data back for the user to edit.
I've tried ContentControl.AfterContentControlLoad where I can access the field, decrypts but the editor doesnt show the decrypted content. Can anyone advise how to solve or is there a better way to encrypt/decrypt data that is readable in the back office ?
public void Content_AfterLoad(ContentControl sender, umbraco.controls.ContentControlLoadEventArgs e) {
if (sender.ContentObject.getProperty("childName")!=null){
Document doc = new Document(sender.ContentObject.Id);
// following two lines correctly decrypt field but the backoffice editor doesnt show updated content
doc.getProperty("childName").Value = Decryption(doc.getProperty("childName").Value.ToString());
sender.ContentObject.getProperty("childName").Value = Decryption(doc.getProperty("childName").Value.ToString());
}
}
Thanks.
is working on a reply...