Approaches to Razor without combining C# in HTML

The move to MVC and MVVM has not been easy for me. Combining multiple languages in single pages is something I find disorienting. I'd like to remedy this by attempting to use Razor Pages, but without writing any C# in the .cshtml page. In some respects, this is an approach very similar to that of the old .aspx web forms - an approach that I found easier to understand. I intend to replicate much of this approach here. Is this possible with Razor Pages? The documentation I have read thus far all points toward true MVVM coding styles, with little reference to the intrinsic relationship between HTML elements and code-behind files - in this case models. The onus behind this question is a transition from a .NET Web Forms project. I can either rewrite the project in Dart with Flutter, or use Razor Pages and keep writing in the language I am most familiar with.

May 10, 2025 - 14:29
 0

The move to MVC and MVVM has not been easy for me. Combining multiple languages in single pages is something I find disorienting. I'd like to remedy this by attempting to use Razor Pages, but without writing any C# in the .cshtml page.

In some respects, this is an approach very similar to that of the old .aspx web forms - an approach that I found easier to understand. I intend to replicate much of this approach here.

Is this possible with Razor Pages? The documentation I have read thus far all points toward true MVVM coding styles, with little reference to the intrinsic relationship between HTML elements and code-behind files - in this case models.

The onus behind this question is a transition from a .NET Web Forms project. I can either rewrite the project in Dart with Flutter, or use Razor Pages and keep writing in the language I am most familiar with.