• 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 AddNewDynamicItem

    Represents the data object that the client can send to the server to request a new partial view for a new list item using ajax. When the controller creates this new partial view, an instance of this class will be stored in the ViewDataDictionary object of the views under the key ItemCreateParameters.

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

    An instance of this class should be specified as the single argument of the controller action that should handle the creation of a new item in your application. In addition, your controller action must end by calling one of the PartialView(Controller, IDynamicList, AddNewDynamicItem) overloads that will take care of rendering the new item for you. An example can be seen below:

    [HttpGet]
    public IActionResult AddBook(AddNewDynamicItem parameters)
    {
        var newBookViewModel = new BookViewModel()
        {
            Title = "New book",
            PublicationYear = "1994"
        };
    
        return this.PartialView(newBookViewModel, parameters);
    }
    Note

    Under normal circumstances, this class should never need to be instantiated directly by your code as it is part of the inner workings of the library.

    Constructors

    | Improve this Doc View Source

    AddNewDynamicItem()

    Creates a new instance of the AddNewDynamicItem class. This is an empty constructor that is necessary to be present in order for IModelBinder deserialize objects of this class correctly.

    Declaration
    public AddNewDynamicItem()
    | Improve this Doc View Source

    AddNewDynamicItem(String, String, String, String, String, ListRenderMode, Object)

    Creates a new instance of AddNewDynamicItem.

    Declaration
    public AddNewDynamicItem(string containerId, string listTemplate, string itemContainerTemplate, string itemTemplate, string prefix, ListRenderMode mode, object additionalViewData)
    Parameters
    Type Name Description
    String containerId
    String listTemplate
    String itemContainerTemplate
    String itemTemplate
    String prefix
    ListRenderMode mode
    Object additionalViewData

    Properties

    | Improve this Doc View Source

    AdditionalViewData

    Gets or sets any additional view data which may have been passed by the user when calling the ListEditorFor<TModel, TValue>(IHtmlHelper<TModel>, Expression<Func<TModel, TValue>>, String, String, String, String, String, String, Object, ListRenderMode, NewItemMethod) extension method, represented by an UTF-8 byte array that can be serialized to JSON and posted back to the server.

    Declaration
    public byte[] AdditionalViewData { get; set; }
    Property Value
    Type Description
    Byte[]
    | Improve this Doc View Source

    ContainerId

    Gets or sets the HTML div ID for the list whose new item should be created for.

    Declaration
    public string ContainerId { get; set; }
    Property Value
    Type Description
    String
    | Improve this Doc View Source

    DisableTraceWarningsForQueryStringsThatContainAdditionalViewData

    Self explanatory.

    Declaration
    public static bool DisableTraceWarningsForQueryStringsThatContainAdditionalViewData { get; set; }
    Property Value
    Type Description
    Boolean
    Remarks

    By default, the library will generate a TraceWarning(String) if you specify any additionalViewData to the ListEditorFor<TModel, TValue>(IHtmlHelper<TModel>, Expression<Func<TModel, TValue>>, String, String, String, String, String, String, Object, ListRenderMode, NewItemMethod) method while also specifying the HTTP method as Get. Setting this static property to false will disable those warnings globally.

    | Improve this Doc View Source

    ItemContainerTemplate

    Gets or sets the ItemContainerTemplate to be used when creating the new item.

    Declaration
    public string ItemContainerTemplate { get; set; }
    Property Value
    Type Description
    String
    | Improve this Doc View Source

    ItemTemplate

    Gets or sets the ItemTemplate to be used when creating the new item.

    Declaration
    public string ItemTemplate { get; set; }
    Property Value
    Type Description
    String
    | Improve this Doc View Source

    ListTemplate

    Gets or sets the ListTemplate to be used when creating the new item.

    Declaration
    public string ListTemplate { get; set; }
    Property Value
    Type Description
    String
    | Improve this Doc View Source

    Mode

    Gets or sets the ListRenderMode to be used when creating the new item.

    Declaration
    public ListRenderMode Mode { get; set; }
    Property Value
    Type Description
    ListRenderMode
    | Improve this Doc View Source

    Prefix

    Gets or sets the HTML prefix to be used when creating the new item.

    Declaration
    public string Prefix { get; set; }
    Property Value
    Type Description
    String

    Methods

    | Improve this Doc View Source

    GetAdditionalViewData()

    Gets the additional view data at AdditionalViewData as a Dictionary<TKey,TValue> containing the key-value pairs in the AdditionalViewData.

    Declaration
    public Dictionary<string, string> GetAdditionalViewData()
    Returns
    Type Description
    Dictionary<String, String>

    A Dictionary<TKey,TValue> representing the contents of the AdditionalViewData property of this class.

    | Improve this Doc View Source

    ToJSON()

    Converts this instance to a JSON representation that can be sent to the server.

    Declaration
    public string ToJSON()
    Returns
    Type Description
    String

    A JSON containing the key-value pairs of the properties of this class.

    | Improve this Doc View Source

    ToQueryString()

    Converts this instance to a GET query string representation that can be sent to the server.

    Declaration
    public string ToQueryString()
    Returns
    Type Description
    String

    An HTTP GET query string containing the key-value pairs of the properties of this class, e.g.:

    "?containerId=SgDdaDhJ&prefix=MyForm.MyProperty&ListTemplate=MyTemplate"
    Remarks
    Warning

    Additional user data is never included in the query string. See ListEditorFor<TModel, TValue>(IHtmlHelper<TModel>, Expression<Func<TModel, TValue>>, String, String, String, String, String, String, Object, ListRenderMode, NewItemMethod) for more details.

    Extension Methods

    EnumerableExtensions.ToDynamicList<TViewModel, TOptions>(TViewModel, String, TOptions)
    EnumerableExtensions.ToDynamicList<TViewModel>(TViewModel, String)
    EnumerableExtensions.ToDynamicList<TViewModel, TOptions>(TViewModel, String, Func<TViewModel, TOptions>)
    EnumerableExtensions.ToDynamicList<TViewModel, TOptions, TModel>(TModel, String, Func<TModel, TViewModel>, Func<TModel, TOptions>)
    EnumerableExtensions.ToDynamicList<TViewModel, TModel>(TModel, String, Func<TModel, TViewModel>)
    EnumerableExtensions.ToDynamicList<TViewModel, TOptions, TModel>(TModel, String, Func<TModel, TOptions>)
    • 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.