London Dev Meetup Rescheduled! Due to unavoidable reasons, the event has been moved to 21st May. Speakers remain the same—any changes will be communicated. Seats are limited—register here to secure your spot!
AI OnAI Off
London Dev Meetup Rescheduled! Due to unavoidable reasons, the event has been moved to 21st May. Speakers remain the same—any changes will be communicated. Seats are limited—register here to secure your spot!
using System;
using System.Web.UI;
using System.Web.UI.WebControls;
using EPiServer.Web.PropertyControls;
using EPiServer.Web.PropertyControls.Adapters;
namespace EPiServerDemo.PropertyTypes
{
public class PropertyStringControlAdapter : PropertyDataControlAdapter
{
private const string PageNamePropertyName = "PageName";
private Label lblMessage;
public override void CreateEditControls()
{
base.CreateEditControls();
if (this.Name.Equals(PageNamePropertyName))
{
//Adding a message beside the PageName property
lblMessage = new Label();
lblMessage.Text = "Note: Please keep PageName short";
lblMessage.Font.Italic = true;
Control.Controls.Add(new LiteralControl(" "));
Control.Controls.Add(lblMessage);
}
}
}
}
You also need to add the following to your AdapterMappings.browser file
If you want to override the complete behavior of the control (not just adding a message), you need to create and add the control yourself (remove call to base.CreateEditControls()) and override ApplyChanges() to save the value (see SDK for sample code).