Declined
Last Updated: 25 Jul 2025 05:03 by ADMIN
Scheduled for 2025 Q2 (May)
Chris
Created on: 03 Dec 2024 12:05
Category: Form
Type: Bug Report
0
EditorTemplateView option does not accept PartialAsync() method

### Bug report

When loading an editor through a partial View using EditorTemplateView(await Html.PartialAsync("PartialViewName")), the following error occurs:

The 'await' operator can only be used within an async lambda expression. Consider marking this lambda expression with the 'async' modifier.

### Reproduction of the problem

@(Html.Kendo().Form<UserViewModel>()
     .Name("myForm")
     .Items(items =>
     {
         items.Add().Field(f => f.Username).EditorTemplateView(await Html.PartialAsync("PartialViewName"));
      })
)

### Expected/desired behavior

The EditorTemplateView() must accept Html.PartialAsync("PartialViewName").

### Environment

* **Telerik UI for ASP.NET Core version: 2024.4.1112
* **Browser: [all]

1 comment
ADMIN
Mihaela
Posted on: 25 Jul 2025 05:03

Closing this after further discussion. Such functionality would inevitably require introducing an asynchronous piece of logic within a synchronous method. This poses a risk in terms of how the underlying threading mechanism for the framework handles this situation.

Adding such a feature would inevitably place the UI thread in a predicament, as it may produce:

  • Deadlocks
  • Thread pool Exhaustion
  • Impede the overall UX experience

There are several topics that discuss this in a more comprehensive manner:

Workaround

It is possible to use a code block, await the call to Html.PartialAsync and pass the result to the EditorTemplateView:

@{
    var myTemplate = await Html.PartialAsync("PartialViewName");
}

@(Html.Kendo().Form<UserViewModel>()
     .Name("myForm")
     .Items(items =>
     {
         items.Add().Field(f => f.Username).EditorTemplateView(myTemplate);
      })
)

Regards,
Mihaela
Progress Telerik

Love the Telerik and Kendo UI products and believe more people should try them? Invite a fellow developer to become a Progress customer and each of you can get a $50 Amazon gift voucher.