Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

EditorTemplateViewFor in FormItemBuilder #8073

Open
kendo-bot opened this issue Dec 5, 2024 · 0 comments
Open

EditorTemplateViewFor in FormItemBuilder #8073

kendo-bot opened this issue Dec 5, 2024 · 0 comments
Labels

Comments

@kendo-bot
Copy link
Contributor

kendo-bot commented Dec 5, 2024

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

@kendo-bot kendo-bot added the FP: Pending Review Sync status with associated Feedback Item label Dec 5, 2024
@github-actions github-actions bot added the FP: Unplanned Sync status with associated Feedback Item label Dec 5, 2024
@mihaela-lukanova mihaela-lukanova added Enhancement S: Wrappers (ASP.NET Core) C: Form FP: Unplanned Sync status with associated Feedback Item and removed FP: Unplanned Sync status with associated Feedback Item FP: Pending Review Sync status with associated Feedback Item labels Dec 5, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants