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!
[public class MyCustomControlCore : EPiServer.Core.PropertyString
{
public override IPropertyControl CreatePropertyControl()
{
return new MyCustomControl();
}
}
public class MyCustomControl : EPiServer.Web.PropertyControls.PropertyStringControl
{
/*
Override CreateXXXControls to control the appearance of the property data in different rendering conditions.
public override void CreateDefaultControls() - Used when rendering the view mode.
public override void CreateEditControls() - Used when rendering the property in edit mode.
public override void CreateOnPageEditControls() - used when rendering the property for "On Page Edit".
*/
}
]
[ ]
using System; using System.Collections.Generic; using System.Text; using EPiServer; using EPiServer.Core; using EPiServer.DataAbstraction; using EPiServer.Web.PropertyControls; using EPiServer.Web.WebControls; namespace MyNamespace { ///
/// PropertyControl implementation used for rendering CustomProperty1 data.
///
public class MyCustomControlPropertyControl : EPiServer.Web.PropertyControls.PropertyStringControl {
protected MyCustomControl theControl = new MyCustomControl(); // obs, MyCustomControl-> ärver ifrån System.Web.UI.Control
public override void CreateEditControls() {
theControl = new MyCustomControl();
/* Försökte även med detta, men inte heller det tycks bita
EPiServer.Core.PropertyControlClassFactory.Instance.RegisterClass(
typeof(EPiServer.Core.PropertyString),
typeof(MyCustomControl));
*/
if(this.PropertyData.Value == null) {
theControl.MyValue = "0,0";
}
else {
theControl.MyValue = this.PropertyData.Value.ToString();
}
theControl.Visible = true;
this.Controls.Add(theControl);
}
public override void CreateOnPageEditControls() {
}
public override void ApplyEditChanges() {
base.SetValue(theControl.MyValue);
}
public MyCustomControlProperty MyCustomControlProperty {
get {
return PropertyData as MyCustomControlProperty;
}
}
}
}