Table of Contents

Class PromptScreenBase<TModel>

Namespace
Dynamicweb.CoreUI.Screens
Assembly
Dynamicweb.CoreUI.dll

Base class for prompt (action-confirmation) screens that render a form, execute a command on submission, and close the overlay on success.

public abstract class PromptScreenBase<TModel> : ScreenBase<TModel> where TModel : DataViewModelBase, new()

Type Parameters

TModel

The data view model type that provides default values for the form fields. Must have a public parameterless constructor so the framework can create a blank instance when no query is supplied.

Inheritance
ScreenBase<TModel>
PromptScreenBase<TModel>
Derived
Inherited Members

Remarks

Use PromptScreenBase<TModel> when a user action requires collecting a small amount of input before executing a command — for example, a "rename" or "create" dialog. For read-only dashboards use OverviewScreenBase<TModel> instead.

Subclasses must implement GetScreenName() and BuildPromptScreen(). Override GetOkCommand() to return the command that is executed when the user confirms, or override GetOkAction() directly for full control over the submit action. Override GetOkActionName() to change the label of the primary button. Override GetEditor(string), GetEditorForQuery(string), or GetEditorForCommand(string) to supply custom editors for specific properties.

Properties

ReloadTypeOnSuccess

Gets or sets the reload scope applied to the workspace after the command succeeds. Defaults to Workspace.

protected ReloadType ReloadTypeOnSuccess { get; set; }

Property Value

ReloadType

ShadowEdit

Gets or sets the shadow-editing session used to track provisional changes before submission. When set, the generated form includes the shadow-edit identifier so the server can resolve the draft.

protected ShadowEdit<TModel>? ShadowEdit { get; set; }

Property Value

ShadowEdit<TModel>

Methods

AddComponent(UiComponentBase?, string)

Adds a single UI component to the prompt form under the given group heading.

protected void AddComponent(UiComponentBase? component, string heading)

Parameters

component UiComponentBase

The component to add. Null is silently ignored.

heading string

The group heading under which the component is placed.

AddComponents(IEnumerable<UiComponentBase?>, string)

Adds multiple UI components to the prompt form under the given group heading.

protected void AddComponents(IEnumerable<UiComponentBase?> components, string heading)

Parameters

components IEnumerable<UiComponentBase>

The components to add. Null entries are silently ignored.

heading string

The group heading under which the components are placed.

AddDynamicFields(Expression<Func<TModel, FieldGroupCollection>>)

Appends dynamic field groups derived from the model property selected by expression to the prompt form. Each field in the collection is rendered using its registered editor provider.

protected void AddDynamicFields(Expression<Func<TModel, FieldGroupCollection>> expression)

Parameters

expression Expression<Func<TModel, FieldGroupCollection>>

A lambda selecting the FieldGroupCollection property on the model.

BuildPromptScreen()

protected abstract void BuildPromptScreen()

ConfigureOkAction(RunCommandAction)

Applies post-execution behaviour to the primary command action. The default implementation adds ClosePopupAndReload with ReloadTypeOnSuccess unless a custom OnSuccess handler is already present.

protected virtual RunCommandAction ConfigureOkAction(RunCommandAction action)

Parameters

action RunCommandAction

The action to configure.

Returns

RunCommandAction

The configured action.

EditorForCommand<TCommand, T>(Expression<Func<TCommand, T>>)

Returns an editor bound to a property of a command, using the property name as the label. The editor's Name is prefixed with Command. so the binder maps it correctly.

protected EditorBase? EditorForCommand<TCommand, T>(Expression<Func<TCommand, T>> expression) where TCommand : CommandBase

Parameters

expression Expression<Func<TCommand, T>>

A lambda selecting the command property to edit.

Returns

EditorBase

A configured editor, or null when no editor can be resolved for the property.

Type Parameters

TCommand

The command type that owns the property.

T

The property value type.

EditorForCommand<TCommand, T>(Expression<Func<TCommand, T>>, string?)

Returns an editor bound to a property of a command with a custom label. The editor's Name is prefixed with Command. so the binder maps it correctly.

protected EditorBase? EditorForCommand<TCommand, T>(Expression<Func<TCommand, T>> expression, string? label) where TCommand : CommandBase

Parameters

expression Expression<Func<TCommand, T>>

A lambda selecting the command property to edit.

label string

Override label displayed next to the editor, or null to use the property name.

Returns

EditorBase

A configured editor, or null when no editor can be resolved for the property.

Type Parameters

TCommand

The command type that owns the property.

T

The property value type.

EditorForCommand<TCommand, T>(Expression<Func<TCommand, T>>, string?, TCommand?)

Returns an editor bound to a property of a command, pre-populated from a command instance. The editor's Name is prefixed with Command. so the binder maps it correctly.

protected EditorBase? EditorForCommand<TCommand, T>(Expression<Func<TCommand, T>> expression, string? label, TCommand? command) where TCommand : CommandBase

Parameters

expression Expression<Func<TCommand, T>>

A lambda selecting the command property to edit.

label string

Override label displayed next to the editor, or null to use the property name.

command TCommand

A command instance whose current property value is used to pre-fill the editor. Pass null to leave the editor empty.

Returns

EditorBase

A configured editor, or null when no editor can be resolved for the property.

Type Parameters

TCommand

The command type that owns the property.

T

The property value type.

EditorForQuery<TQuery, T>(Expression<Func<TQuery, T>>)

Returns an editor bound to a property of a query, using the property name as the label. The editor's Name is prefixed with Query. so the binder maps it correctly.

protected EditorBase? EditorForQuery<TQuery, T>(Expression<Func<TQuery, T>> expression) where TQuery : DataQueryBase

Parameters

expression Expression<Func<TQuery, T>>

A lambda selecting the query property to edit.

Returns

EditorBase

A configured editor, or null when no editor can be resolved for the property.

Type Parameters

TQuery

The query type that owns the property.

T

The property value type.

EditorForQuery<TQuery, T>(Expression<Func<TQuery, T>>, string?)

Returns an editor bound to a property of a query with a custom label. The editor's Name is prefixed with Query. so the binder maps it correctly.

protected EditorBase? EditorForQuery<TQuery, T>(Expression<Func<TQuery, T>> expression, string? label) where TQuery : DataQueryBase

Parameters

expression Expression<Func<TQuery, T>>

A lambda selecting the query property to edit.

label string

Override label displayed next to the editor, or null to use the property name.

Returns

EditorBase

A configured editor, or null when no editor can be resolved for the property.

Type Parameters

TQuery

The query type that owns the property.

T

The property value type.

EditorForQuery<TQuery, T>(Expression<Func<TQuery, T>>, string?, TQuery?)

Returns an editor bound to a property of a query, pre-populated from a query instance. The editor's Name is prefixed with Query. so the binder maps it correctly.

protected EditorBase? EditorForQuery<TQuery, T>(Expression<Func<TQuery, T>> expression, string? label, TQuery? query) where TQuery : DataQueryBase

Parameters

expression Expression<Func<TQuery, T>>

A lambda selecting the query property to edit.

label string

Override label displayed next to the editor, or null to use the property name.

query TQuery

A query instance whose current property value is used to pre-fill the editor. Pass null to leave the editor empty.

Returns

EditorBase

A configured editor, or null when no editor can be resolved for the property.

Type Parameters

TQuery

The query type that owns the property.

T

The property value type.

EditorFor<T>(Expression<Func<TModel, T>>)

Returns an editor bound to a property of TModel, using the property name as the label. The current model value is used to pre-populate the editor.

protected EditorBase? EditorFor<T>(Expression<Func<TModel, T>> expression)

Parameters

expression Expression<Func<TModel, T>>

A lambda selecting the model property to edit.

Returns

EditorBase

A configured editor, or null when no editor can be resolved for the property.

Type Parameters

T

The property value type.

EditorFor<T>(Expression<Func<TModel, T>>, string?)

Returns an editor bound to a property of TModel with a custom label. The current model value is used to pre-populate the editor.

protected EditorBase? EditorFor<T>(Expression<Func<TModel, T>> expression, string? label)

Parameters

expression Expression<Func<TModel, T>>

A lambda selecting the model property to edit.

label string

Override label displayed next to the editor, or null to use the property name.

Returns

EditorBase

A configured editor, or null when no editor can be resolved for the property.

Type Parameters

T

The property value type.

GetAlert()

protected virtual Alert? GetAlert()

Returns

Alert

GetDefinitionInternal()

Builds and returns the raw component tree for this screen.

protected override sealed UiComponentBase GetDefinitionInternal()

Returns

UiComponentBase

Remarks

Implement this method in every concrete screen class. The result is post-processed by GetDefinition() (injectors, trimming, preset actions) before being returned to the framework.

GetEditor(string)

Returns a custom editor for a named property of TModel. Called by EditorFor<T>(Expression<Func<TModel, T>>) before falling back to the default editor.

protected virtual EditorBase? GetEditor(string propertyName)

Parameters

propertyName string

The property name for which an editor is requested.

Returns

EditorBase

A custom editor, or null to use the default editor for the property type.

GetEditorForCommand(string)

Returns a custom editor for a named property of a command type. Called by the EditorForCommand overloads before falling back to the default editor.

protected virtual EditorBase? GetEditorForCommand(string propertyName)

Parameters

propertyName string

The property name for which an editor is requested.

Returns

EditorBase

A custom editor, or null to use the default editor for the property type.

GetEditorForQuery(string)

Returns a custom editor for a named property of a query type. Called by the EditorForQuery overloads before falling back to the default editor.

protected virtual EditorBase? GetEditorForQuery(string propertyName)

Parameters

propertyName string

The property name for which an editor is requested.

Returns

EditorBase

A custom editor, or null to use the default editor for the property type.

GetOkAction()

Returns the action assigned to the primary (OK/Create) button. The default implementation wraps the command returned by GetOkCommand() in a RunCommandAction. Override for full control over the submit action.

protected virtual ActionBase? GetOkAction()

Returns

ActionBase

The submit action, or null to render no primary button.

GetOkActionName()

Returns the label shown on the primary action button. Defaults to "Create".

protected virtual string GetOkActionName()

Returns

string

A non-empty string for the button label.

GetOkCommand()

Returns the command to execute when the user confirms the prompt. Override this method as the preferred way to wire up the submit action.

protected virtual CommandBase<TModel>? GetOkCommand()

Returns

CommandBase<TModel>

The command to run on confirmation, or null if no command is needed.

GetScreenName()

Returns the display name shown in the screen header.

protected abstract string GetScreenName()

Returns

string

A non-empty string identifying this screen to the user.

To top