An edit screen is a screen for editing a single record — a product, a user, a configuration entry, anything at all. It renders a form with one or more tabs, each containing groups of editors. The topbar automatically gains Cancel, Save, and Save and close buttons when you supply a save command.
When to build a custom edit screen
Build a custom edit screen when your add-on manages its own data records and you want a first-class editing experience — an info bar, tabbed layout, and a save button that persists your data. If you only need to add a few fields to an existing screen, use an EditScreenInjector instead.
Required overrides
Inherit from EditScreenBase<TModel> in Dynamicweb.CoreUI.Screens, where TModel is your DataViewModelBase subclass.
| Override | Purpose |
|---|---|
string GetScreenName() |
Title shown in the topbar |
void BuildEditScreen() |
Add tabs, groups, and editors |
CommandBase<TModel>? GetSaveCommand() |
Return the command that persists the model; return null to make the screen read-only |
Laying out the screen
Inside BuildEditScreen use AddComponents to add editors to a named tab and group:
AddComponents("tabName", new LayoutWrapper[]
{
new LayoutWrapper("Group heading",
[
EditorFor(m => m.Name),
EditorFor(m => m.Description),
]),
});
LayoutWrapper groups a set of editors under a single section heading. Pass multiple LayoutWrapper instances in the array to create multiple groups inside the same tab call.
EditorFor returns the editor for a model property. The property must be marked [ConfigurableProperty] on the model. For each property the framework automatically selects a sensible default editor (text input for string, checkbox for bool, date picker for DateTime, etc.). Override GetEditor to replace that default.
Worked example
This is a complete, minimal edit screen for a hypothetical ServiceDataModel with a save command:
using Dynamicweb.CoreUI.Data;
using Dynamicweb.CoreUI.Screens;
public sealed class ServiceEditScreen : EditScreenBase<ServiceDataModel>
{
protected override string GetScreenName()
=> Model?.Id > 0 ? Model.Name : "New service";
protected override CommandBase<ServiceDataModel>? GetSaveCommand()
=> new ServiceSaveCommand();
protected override void BuildEditScreen()
{
AddComponents("General", new LayoutWrapper[]
{
new LayoutWrapper("Details",
[
EditorFor(m => m.Name),
EditorFor(m => m.Description),
EditorFor(m => m.Active),
EditorFor(m => m.ExpiryDate),
]),
new LayoutWrapper("Contact",
[
EditorFor(m => m.ContactEmail),
EditorFor(m => m.ContactPhone),
]),
});
AddComponents("Settings", new LayoutWrapper[]
{
new LayoutWrapper("Options",
[
EditorFor(m => m.MaxRetries),
EditorFor(m => m.TimeoutSeconds),
]),
});
}
}
This produces a two-tab form ("General" and "Settings"). The first tab has two groups ("Details" and "Contact"); the second has one group ("Options"). The topbar shows Save / Save and close / Cancel automatically because GetSaveCommand is overridden.
Overriding the editor for a property
GetEditor(string propertyName) lets you replace the default editor for any property. Return null for properties you want to leave as-is.
protected override EditorBase? GetEditor(string property) => property switch
{
nameof(ServiceDataModel.CountryCode) =>
EditorsHelper.CreateRegionCodeSelect(),
nameof(ServiceDataModel.MaxRetries) =>
new NumberInput { Min = 1, Max = 10 },
_ => null,
};
Adding an info bar
Call SetInfobar inside BuildEditScreen to place an info bar above the tabs.
protected override void BuildEditScreen()
{
SetInfobar(new InfoBar
{
Information = new Dictionary<string, InfoValue>
{
{ "ID", new InfoValue(Model?.Id.ToString() ?? "") },
{ "Active", new InfoValue(Model?.Active ?? false) },
}
});
AddComponents("General", ...);
}
Dynamic fields
If your model exposes a FieldGroupCollection property (populated by custom field infrastructure), call AddDynamicFields to render those fields automatically:
protected override void BuildEditScreen()
{
AddComponents("General", ...);
AddDynamicFields("Custom fields", m => m.CustomFields);
}
Optional overrides
| Override | What it does |
|---|---|
IEnumerable<EditorMapping>? GetEditorMappings() |
Provide advanced editor mappings — read-only predicates, hidden predicates, fallback values |
IEnumerable<ActionGroup>? GetScreenActions() |
Add entries to the Actions context menu in the topbar |
NavigateScreenAction? GetOnCloseNavigateAction() |
Where to navigate when the user clicks Cancel |
string? GetExplanation(string propertyName) |
Explanation text shown below a specific editor |
string? GetHint(string propertyName) |
Short hint/tooltip text for a specific editor |
Read-only editors via GetEditorMappings
protected override IEnumerable<EditorMapping> GetEditorMappings()
{
yield return CreateMapping(m => m.Prefix) with
{
ReadOnlyPredicate = m => m.Id > 0 // read-only after creation
};
}
Gotchas
TModelmust have a parameterless public constructor. The framework instantiates it vianew(). If your model has required constructor parameters you cannot useEditScreenBasedirectly.GetSaveCommandreturningnullsuppresses Save buttons entirely. Use this deliberately to create read-only detail screens.BuildEditScreenis called after injectors runOnBefore. Do not cache injector-modified model values beforeBuildEditScreenexecutes — readModelat call time.SetInfobarmust be called beforeAddComponents. Calling it after the tabs are laid out is safe but convention is to set it first.- Discovery is automatic. Dynamicweb finds your screen via
AddInManager. You still need to wire it to an area tree node for it to be reachable.
Connecting the screen to the administration UI
A screen class alone is not enough — you need to link to it from the area tree. Typically you do this by creating a NavigateScreenAction that points at the screen:
new ActionNode
{
Name = "Services",
Icon = Icon.Gear,
NodeAction = NavigateScreenAction.To<ServiceListScreen>().With(new ServiceListQuery())
}
See the area tree documentation for the full setup.