November Happy Hour will be moved to Thursday December 5th.
November Happy Hour will be moved to Thursday December 5th.
using System;
using System.Collections.Generic;
using System.Text;
using EPiServer;
using EPiServer.Core;
using EPiServer.DataAbstraction;
using EPiServer.PlugIn;
using EPiServer.Web.PropertyControls;
using System.Web.UI.WebControls;
namespace EPiServerDemo.PropertyTypes
{
///
/// Custom PropertyData implementation
///
[Serializable]
[PageDefinitionTypePlugIn(DisplayName="My demo dropdown")]
public class MyDropDownCore : EPiServer.Core.PropertyString
{
public override IPropertyControl CreatePropertyControl()
{
return new MyDropDownPropType();
}
}
public class MyDropDownPropType : EPiServer.Web.PropertyControls.PropertySelectControlBase
{
protected override void SetupEditControls()
{
base.SetupEditControls();
DropDownList inputControl = this.EditControl;
inputControl.Items.Add("Red");
inputControl.Items.Add("Blue");
inputControl.Items.Add("Green");
inputControl.SelectedValue = this.PropertyData.Value as string;
}
}
}
hi Mari Jørgensen, I am using the same method you said but it is showing me No source Available page while debugging(In Episerver7).I have ignored that message and continued by selecting My demo dropdown from the properties list of that pagetype. But, in Edit mode it displays an empty field instead of a dropdown. What may the issue?
Here is the description of the Debugging error.
Locating source for 'http://server/EPiServer/CMS/Admin/EditPropertyDefinition.aspx'. (No checksum.)
Looking in script documents for 'http://server/EPiServer/CMS/Admin/EditPropertyDefinition.aspx'...
Looking in the projects for 'http://server/EPiServer/CMS/Admin/EditPropertyDefinition.aspx'.
The file was not found in a project.
Looking in directory 'C:\Program Files (x86)\Microsoft Visual Studio 10.0\Common7\IDE\vc7\atlmfc'...
Looking in directory 'C:\Program Files (x86)\Microsoft Visual Studio 10.0\Common7\IDE\vc7\crt'...
The debugger will ask the user to find the file: EPiServer\CMS\Admin\EditPropertyDefinition.aspx.
The user pressed Cancel in the Find Source dialog. The debug source files settings for the active solution have been modified so that the debugger will not ask the user to find the file: http://server/EPiServer/CMS/Admin/EditPropertyDefinition.aspx.
The debugger could not locate the source file 'http://server/EPiServer/CMS/Admin/EditPropertyDefinition.aspx'.
I have created a class (PageType) with the name of DropDownCustomControl in the Models Folder. Is it right way to do? Please help me out by replying to this.
Can you share the full process.....of creating the custom dropdown property?
@Bhargav, this thread is about EPiServer CMS v5 which you are hopefully not currently using.
If you want to know how to create a drop down property in a recent version, please check out https://world.episerver.com/documentation/developer-guides/CMS/Content/Properties/built-in-property-types/Single-or-multiple-list-options/ for information.