• Introduction
  • API Documentation
  • Sample Apps
  • GitHub

    Show / Hide Table of Contents
    • DynamicVML
      • AddNewDynamicItem
      • DynamicList<TViewModel, TOptions>
      • DynamicList<TViewModel>
      • DynamicListItem<TViewModel>
      • IDynamicList
      • IDynamicList<TValue>
      • IDynamicListItem
      • IDynamicListItem<TViewModel>
      • ListRenderMode
      • NewItemMethod
    • DynamicVML.Extensions
      • ControllerExtensions
      • EditorExtensions
      • EnumerableExtensions
      • ViewDataExtensions
    • DynamicVML.Internals
      • Constants
      • ItemDisplayParameters
      • ItemEditorParameters
      • ItemParameters
      • ListDisplayParameters
      • ListEditorParameters
      • ListParameters
      • Parameters
    • DynamicVML.Options
      • DynamicListAttribute
      • DynamicListDisplayOptions
      • DynamicListEditorOptions
      • DynamicListOptions

    Class EditorExtensions

    Contains extension methods for rendering different parts of the list from .cshtml view files.

    Inheritance
    Object
    EditorExtensions
    Inherited Members
    Object.Equals(Object)
    Object.Equals(Object, Object)
    Object.GetHashCode()
    Object.GetType()
    Object.MemberwiseClone()
    Object.ReferenceEquals(Object, Object)
    Object.ToString()
    Namespace: DynamicVML.Extensions
    Assembly: DynamicVML.dll
    Syntax
    public static class EditorExtensions
    Remarks

    The methods in this class can be used to render different regions of a dynamic list from within a view. A quick reference for the regions can be seen in the figure below:

    Methods

    | Improve this Doc View Source

    DisplayListFor<TModel, TValue>(IHtmlHelper<TModel>, Expression<Func<TModel, TValue>>, String, String, String, String, Object, ListRenderMode)

    Renders a dynamic list for display. Please see the image in the remarks section for a quick understanding of all the different templates that can be specified.

    Declaration
    public static IHtmlContent DisplayListFor<TModel, TValue>(this IHtmlHelper<TModel> html, Expression<Func<TModel, TValue>> propertyExpression, string itemTemplate = null, string itemContainerTemplate = null, string listTemplate = null, string listContainerTemplate = "DynamicListContainer", object additionalViewData = null, ListRenderMode mode = ListRenderMode.ViewModelOnly)
        where TValue : IDynamicList
    Parameters
    Type Name Description
    IHtmlHelper<TModel> html

    The IHtmlHelper<TModel> from your current view.

    Expression<Func<TModel, TValue>> propertyExpression

    An expresion to be evaluated against the current model.

    String itemTemplate

    The view name for the view models to be displayed.

    String itemContainerTemplate

    The template for the "DynamicItemContainer" part of the list.

    String listTemplate

    The template for the "DynamicList" part of the list.

    String listContainerTemplate

    The template for the "DynamicListContainer" part of the list.

    Object additionalViewData

    An anonymous object or Dictionary<TKey,TValue> that can contain additional view data that will be merged into the ViewDataDictionary instance created for the template.

    ListRenderMode mode

    The ListRenderMode to be used when rendering the template for your view model. Please see the ListRenderMode for more details.

    Returns
    Type Description
    IHtmlContent

    The rendered HTML for the list.

    Type Parameters
    Name Description
    TModel

    The type of the model object in your current view.

    TValue

    The list to be displayed.

    Remarks

    | Improve this Doc View Source

    GetDynamicListActionUrl(IHtmlHelper<IDynamicList>)

    Gets a string with information about how request a new item from the server. Please see GetActionInfo() for more information.

    Declaration
    public static string GetDynamicListActionUrl(this IHtmlHelper<IDynamicList> html)
    Parameters
    Type Name Description
    IHtmlHelper<IDynamicList> html

    The IHtmlHelper<TModel> associated with the current view.

    Returns
    Type Description
    String

    A string containing information to be passed to the JavaScript scripts.

    | Improve this Doc View Source

    ListEditorFor<TModel, TValue>(IHtmlHelper<TModel>, Expression<Func<TModel, TValue>>, String, String, String, String, String, String, Object, ListRenderMode, NewItemMethod)

    Renders a dynamic list for display. Please see the image in the EditorExtensions remarks section to get a quick understanding of which part this refers to.

    Declaration
    public static IHtmlContent ListEditorFor<TModel, TValue>(this IHtmlHelper<TModel> html, Expression<Func<TModel, TValue>> propertyExpression, string actionUrl = null, string addNewItemText = null, string itemTemplate = null, string itemContainerTemplate = null, string listTemplate = null, string listContainerTemplate = "DynamicListContainer", object additionalViewData = null, ListRenderMode mode = ListRenderMode.ViewModelOnly, NewItemMethod method = NewItemMethod.Get)
        where TValue : IDynamicList
    Parameters
    Type Name Description
    IHtmlHelper<TModel> html

    The IHtmlHelper<TModel> from your current view.

    Expression<Func<TModel, TValue>> propertyExpression

    An expresion to be evaluated against the current model.

    String actionUrl

    The path to the controller action responsible for generating the view for a new item.

    String addNewItemText

    The text to be displayed in the button that the user can click to add a new item to the list.

    String itemTemplate

    The view name for the view models to be displayed.

    String itemContainerTemplate

    The template for the "DynamicItemContainer" part of the list.

    String listTemplate

    The template for the "DynamicList" part of the list.

    String listContainerTemplate

    The template for the "DynamicListContainer" part of the list.

    Object additionalViewData

    An anonymous object or Dictionary<TKey,TValue> that can contain additional view data that will be merged into the ViewDataDictionary instance created for the template.

    ListRenderMode mode

    The ListRenderMode to be used when rendering the template for your view model. Please see the ListRenderMode for more details.

    NewItemMethod method

    The NewItemMethod to use, whether Get or Post.

    Returns
    Type Description
    IHtmlContent

    The rendered HTML for the list.

    Type Parameters
    Name Description
    TModel

    The type of the model object in your current view.

    TValue

    The list to be displayed.

    Remarks
    Warning

    The additionalViewData object will not be sent back to the server when the user clicks the "Add new item" button if method is also set to Get. However, it will still be passed to the templates during the first rendering of the list. In order to be able to receive the additional data from the controller, please also specify method: NewItemMethod.Post.

    | Improve this Doc View Source

    RenderDynamicItemContainerDisplay<TModel>(IHtmlHelper<TModel>, String)

    Renders the "DynamicItemContainer" part of the list to the view. Please see the image in the EditorExtensions remarks section to get a quick understanding of which part this refers to.

    Declaration
    public static IHtmlContent RenderDynamicItemContainerDisplay<TModel>(this IHtmlHelper<TModel> html, string itemId)
        where TModel : IDynamicList
    Parameters
    Type Name Description
    IHtmlHelper<TModel> html

    The IHtmlHelper<TModel> from your current view.

    String itemId

    The div id (key of the item in the DynamicList<TViewModel, TOptions>) for the current item being rendered.

    Returns
    Type Description
    IHtmlContent

    An awaitable async task.

    Type Parameters
    Name Description
    TModel

    The type of the model object in your current view.

    | Improve this Doc View Source

    RenderDynamicItemContainerEditor<TModel>(IHtmlHelper<TModel>, String)

    Renders the "DynamicItemContainer" part of the list to the view. Please see the image in EditorExtensions remarks section to get a quick understanding of which part this refers to.

    Declaration
    public static IHtmlContent RenderDynamicItemContainerEditor<TModel>(this IHtmlHelper<TModel> html, string itemId)
        where TModel : IDynamicList
    Parameters
    Type Name Description
    IHtmlHelper<TModel> html

    The IHtmlHelper<TModel> from your current view.

    String itemId

    The div id (key of the item in the DynamicList<TViewModel, TOptions>) for the current item being rendered.

    Returns
    Type Description
    IHtmlContent

    An awaitable async task.

    Type Parameters
    Name Description
    TModel

    The type of the model object in your current view.

    | Improve this Doc View Source

    RenderDynamicItemDisplay<TModel>(IHtmlHelper<TModel>)

    Renders the "Item" part of the list to the view. This corresponds to your actual user-provided view for your current viewmodel. Please see the image in EditorExtensions remarks section to get a quick understanding of which part this refers to.

    Declaration
    public static IHtmlContent RenderDynamicItemDisplay<TModel>(this IHtmlHelper<TModel> html)
        where TModel : IDynamicListItem
    Parameters
    Type Name Description
    IHtmlHelper<TModel> html

    The IHtmlHelper<TModel> from your current view.

    Returns
    Type Description
    IHtmlContent

    An awaitable async task.

    Type Parameters
    Name Description
    TModel

    The type of the model object in your current view.

    | Improve this Doc View Source

    RenderDynamicItemEditor<TModel>(IHtmlHelper<TModel>)

    Renders the "Item" part of the list to the view. This corresponds to your actual user-provided view for your current viewmodel. Please see the image in EditorExtensions remarks section to get a quick understanding of which part this refers to.

    Declaration
    public static IHtmlContent RenderDynamicItemEditor<TModel>(this IHtmlHelper<TModel> html)
        where TModel : IDynamicListItem
    Parameters
    Type Name Description
    IHtmlHelper<TModel> html

    The IHtmlHelper<TModel> from your current view.

    Returns
    Type Description
    IHtmlContent

    An awaitable async task.

    Type Parameters
    Name Description
    TModel

    The type of the model object in your current view.

    | Improve this Doc View Source

    RenderDynamicListAddNewItemText(IHtmlHelper<IDynamicList>)

    Renders the "Add new item" text that have been defined in the AddNewItemText to the view.

    Declaration
    public static string RenderDynamicListAddNewItemText(this IHtmlHelper<IDynamicList> html)
    Parameters
    Type Name Description
    IHtmlHelper<IDynamicList> html

    The IHtmlHelper<TModel> associated with the current view.

    Returns
    Type Description
    String

    A string containing the specified text, e.g., "Add new book".

    | Improve this Doc View Source

    RenderDynamicListDisplay<TModel>(IHtmlHelper<TModel>)

    Renders the "DynamicList" part of the list to the view. Please see the image in EditorExtensions remarks section to get a quick understanding of which part this refers to.

    Declaration
    public static void RenderDynamicListDisplay<TModel>(this IHtmlHelper<TModel> html)
        where TModel : IDynamicList
    Parameters
    Type Name Description
    IHtmlHelper<TModel> html

    The IHtmlHelper<TModel> from your current view.

    Type Parameters
    Name Description
    TModel

    The type of the model object in your current view.

    | Improve this Doc View Source

    RenderDynamicListEditor<TModel>(IHtmlHelper<TModel>)

    Renders the "DynamicList" part of the list to the view. Please see the image in EditorExtensions remarks section to get a quick understanding of which part this refers to.

    Declaration
    public static void RenderDynamicListEditor<TModel>(this IHtmlHelper<TModel> html)
        where TModel : IDynamicList
    Parameters
    Type Name Description
    IHtmlHelper<TModel> html

    The IHtmlHelper<TModel> from your current view.

    Type Parameters
    Name Description
    TModel

    The type of the model object in your current view.

    • Improve this Doc
    • View Source
    Back to top Copyright © 2020 César Roberto de Souza - All files are available under the MIT license except the logo, which comes from FontAwesome.