Table of Contents

Class ViewDataDictionaryExtensions

Namespace
Kentico.Forms.Web.Mvc
Assembly
Kentico.Content.Web.Mvc.dll

Contains helper methods for adding and getting Form builder related configuration data to and from Microsoft.AspNetCore.Mvc.ViewFeatures.ViewDataDictionary.

public static class ViewDataDictionaryExtensions
Inheritance
object
ViewDataDictionaryExtensions

Fields

EDITOR_HTML_ATTRIBUTES_KEY

Key under which is System.Collections.Generic.IDictionary<TKey, TValue> containing editor HTML attributes stored in ViewDataDictionary.

public const string EDITOR_HTML_ATTRIBUTES_KEY = "EditorHtmlAttributes"

Field Value

string

FORM_FIELD_RENDERING_CONFIGURATION_KEY

Key under which is FormFieldRenderingConfiguration instance stored in ViewDataDictionary.

public const string FORM_FIELD_RENDERING_CONFIGURATION_KEY = "FormFieldRenderingConfiguration"

Field Value

string

Methods

AddEditorHtmlAttributes(ViewDataDictionaryExtensionPoint, IDictionary<string, object>)

Adds instance of System.Collections.Generic.IDictionary<TKey, TValue> containing editor HTML attributes into ViewDataDictionary.

public static void AddEditorHtmlAttributes(this ViewDataDictionaryExtensionPoint viewData, IDictionary<string, object> editorHtmlAttributes)

Parameters

viewData ViewDataDictionaryExtensionPoint

View data to add the attributes to.

editorHtmlAttributes IDictionary<string, object>

Editor HTML attributes.

Exceptions

ArgumentNullException

Thrown when viewData is null.

AddFormFieldRenderingConfiguration(ViewDataDictionaryExtensionPoint, FormFieldRenderingConfiguration)

Adds instance of FormFieldRenderingConfiguration into ViewDataDictionary.

public static void AddFormFieldRenderingConfiguration(this ViewDataDictionaryExtensionPoint viewData, FormFieldRenderingConfiguration formFieldRenderingConfiguration)

Parameters

viewData ViewDataDictionaryExtensionPoint

View data to add the configuration to.

formFieldRenderingConfiguration FormFieldRenderingConfiguration

Form field rendering configuration.

Exceptions

ArgumentNullException

Thrown when viewData is null.

GetEditorHtmlAttributes(ViewDataDictionaryExtensionPoint)

Gets System.Collections.Generic.IDictionary<TKey, TValue> containing editor HTML attributes from ViewDataDictionary.

public static IDictionary<string, object> GetEditorHtmlAttributes(this ViewDataDictionaryExtensionPoint viewData)

Parameters

viewData ViewDataDictionaryExtensionPoint

View data to get the attributes from.

Returns

IDictionary<string, object>

Instance of System.Collections.Generic.IDictionary<TKey, TValue> or null if no data are found or ViewDataDictionary is not initialized.

GetFormFieldRenderingConfiguration(ViewDataDictionaryExtensionPoint)

Gets FormFieldRenderingConfiguration from ViewDataDictionary.

public static FormFieldRenderingConfiguration GetFormFieldRenderingConfiguration(this ViewDataDictionaryExtensionPoint viewData)

Parameters

viewData ViewDataDictionaryExtensionPoint

View data to get the configuration from.

Returns

FormFieldRenderingConfiguration

Instance of FormFieldRenderingConfiguration or null if no data are found or ViewDataDictionary is not initialized.