- Add-ons
- Architecture
- BLOB providers
- Caching
- Client resources
- Configuration
- Configuring .NET SignalR
- Configuring episerver
- Configuring episerver.basicAuthentication
- Configuring episerver.dataStore
- Configuring episerver.framework
- Configuring episerver.packaging
- Configuring episerver.search
- Configuring episerver.shell
- Configuring Image Service
- Configuring link validation
- Configuring Live Monitor
- Configuring module.config
- Configuring staticFile
- Reading application settings programmatically
- Content
- Synchronization
- Selecting content
- Refactoring content type classes
- Persisting IContent instances
- Block types and templates
- Content
- Content Type attributes
- Converting page types for pages
- Creating a page programmatically
- Creating page templates and block controls
- Edit hints in MVC
- IContentRepository/DataFactory interface
- Localizing the user interface
- Page types and templates
- Providers
- Properties
- Assets and media
- Links
- Deployment
- Dynamic content
- Dynamic data store
- Editing
- EPiServer CMO
- Event management
- Globalization
- Initialization
- Localization
- Logging
- Personalization
- Rendering
- Reports
- Routing
- Scheduled jobs
- Search
- About EPiServer Full-Text Search Client
- About EPiServer Full-Text Search Service
- Adding search providers
- Configuring EPiServer Full-Text Search Client
- Configuring EPiServer Full-Text Search Service
- Installing and deploying Search Service
- Search integration
- Searching and filtering
- Searching for pages based on page type
- Security
- AspNet Identity OWIN authentication
- Authentication and authorization
- Configuring Active Directory membership provider
- Configuring Web Services authentication
- Federated security
- Forms authentication
- Managing cookies on the website
- Mixed mode OWIN authentication
- OWIN authentication
- Permissions to functions
- Protecting users from session hijacking
- Recommendations for ASP.NET security settings
- Securing edit and admin user interfaces
- Virtual roles
- User interface
- Context-sensitive components
- Creating a component
- Describing content in the UI
- Developing gadgets
- Dialogs
- Drag-and-drop
- Extending edit view
- Extending the navigation
- Introduction to Dojo
- Message service pool
- Publish and subscribe messaging system
- Service locator
- Shell profile
- Store architecture
- Technical overview
- Using jQuery
- Command Pattern
- Object editing
- Views
- Virtual path providers
- Workflows
- XForms
This content is retired. See latest version here.
Last updated: Sep 19 2014
Single or multiple list options
This document describes how to set up single/multiple selection from a list of predefined values using the attributes located in the EPiServer.Shell.ObjectEditing namespace in the EPiServer.UI assembly: SelectOne and SelectMany. These can be defined on a property and requires a reference to a class implementing the ISelectionFactory interface:
[ContentType] public class SamplePage : PageData { [SelectOne(SelectionFactoryType=typeof(LanguageSelectionFactory))] public virtual string SingleLanguage { get; set; } [SelectMany(SelectionFactoryType = typeof(LanguageSelectionFactory))] public virtual string MultipleLanguage { get; set; } } public class LanguageSelectionFactory : ISelectionFactory { public IEnumerable<ISelectItem> GetSelections(ExtendedMetadata metadata) { return new ISelectItem[] { new SelectItem() { Text = "English", Value = "EN" }, new SelectItem() { Text = "Swahili", Value = "SW" }, new SelectItem() { Text = "French Polonesia", Value = "PF" } }; } }
Creating your own attributes
Since you want to follow the DRY principle and avoid adding the reference to the selection factory in a lot of attributes it might be good creating your own attribute if you will use them in several places. This can be done by inheriting from the EPiServer attributes and just overriding the SelectionFactoryType property:
[AttributeUsage(AttributeTargets.Property, AllowMultiple = false)] public class LanguageSelectionAttribute : SelectOneAttribute { public override Type SelectionFactoryType { get { return typeof(LanguageSelectionFactory); } set { base.SelectionFactoryType = value; } } }
Comments