Unplanned
Last Updated: 05 Dec 2024 14:44 by ADMIN
Steve
Created on: 29 Nov 2024 02:33
Category: Form
Type: Feature Request
0
EditorTemplateViewFor in FormItemBuilder

The FormItemBuilder exposes an EditorTemplateView method which allows a view to represent the item and provides the entire modal to the view.

As the elements available to forms are limited to those hard coded by Telerik and whilst extension methods can be employed to expand this limitation slightly, the ability to create a context specific view would be ideal

The current implementation looks like this

Html.Kendo().Form<Model>()
    .Items(items =>
    {
        items.AddGroup("Test", 1, 10)
            .Items(i =>
                {
                    i.Add().Field(x => x.Username)
                    i.Add().Field(x => x.Password).EditorTemplateView(Html.Partial("MyView"))
                }
            );
    })

In this example, the entire model is provided into MyView. 

I suggest adding an EditorTemplateFor that uses the lamda expression provided in the Field() method such as

Html.Kendo().Form<Model>()
    .Items(items =>
    {
        items.AddGroup("Test", 1, 10)
            .Items(i =>
                {
                    i.Add().Field(x => x.Username)
                    i.Add().Field(x => x.Password).EditorTemplateViewFor(Html.Partial("MyView"))
                }
            );
    })
Using the convention I would expect MyView to be provided the Password field only
0 comments