Create the following code snippet on CustomPageEventHandler.cs file at \App_Code\Global\
using CMS.Base;
using CMS.DocumentEngine;
using CMS.Membership;
[CustomPageEventHandler]
public partial class CMSModuleLoader
{
/// <summary>
/// Summary description for CustomPageEventHandler
/// </summary>
public class CustomPageEventHandler : CMSLoaderAttribute
{
/// <summary>
/// Called automatically when the application starts
/// </summary>
public override void Init()
{
DocumentEvents.Insert.After += Insert_After;
DocumentEvents.Update.After += Update_After;
}
/// <summary>
/// Insert after Event Handler for the creation of documents in content tree.
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
void Insert_After(object sender, DocumentEventArgs e)
{
var treeNode = e.Node;
if (e.Node.ClassName.Equals("custom.ContactTest"))
{
treeNode.SetValue("FullName", e.Node.GetValue("FirstName") + " " + e.Node.GetValue("LastName"));
}
treeNode.Update();
}
/// <summary>
/// Update after Event Handler for the creation of documents in content tree.
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
void Update_After(object sender, DocumentEventArgs e)
{
var treeNode = e.Node;
if (e.Node.ClassName.Equals("custom.ContactTest"))
{
treeNode.SetValue("FullName", e.Node.GetValue("FirstName") + " " + e.Node.GetValue("LastName"));
}
treeNode.Update();
}
}
}