Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • Shahid Hafiz 9 posts 29 karma points
    Jan 12, 2014 @ 02:22
    Shahid Hafiz
    0

    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.

Please Sign in or register to post replies

Write your reply to:

Draft