Overview
Overview
This sample shows how features of the C1 MVC Controls can be implemented in Razor Pages.
Features
Overview
ASP.NET Core 2.0 was released with a new feature called Razor Pages.
Unlike MVC, Razor Pages contain a Razor view and a PageModel code behind class.
For more details, please refer Introduction to Razor Pages in ASP.NET Core
C1 MVC Controls already support Razor Pages and the implementation is almost same as that of MVC, with just a few differences. This sample takes few controls and features as example to demonstrate their implementation with Razor Pages.
FlexGrid
This view shows the basic features of FlexGrid in Razor Pages. These basic features can be implemented with same settings as done in the case of MVC, but need @Html.AntiForgeryToken() token to be added.
Batch Editing
This view shows an Excel-like editing in FlexGrid in Razor Pages. The FlexGrid control has built-in support for Excel-like, fast, in-cell editing. So, there is no need to add extra columns with 'Edit' buttons that switch between display and edit modes.
Such features can be implemented in Razor Pages just like any other basic feature by adding handlers for model binding and batch editing, and a token @Html.AntiForgeryToken().
Unobtrusive Validation
The implementation of unobtrusive validation in Razor Pages is a little different from MVC. The model of razor page view is PageModel, but currently, our MVC Controls only support IEnumerable model for unobtrusive validation. However, there is a workaround that uses a partial view with IEnumerable model for FlexGrid.
FlexChart
This view shows the basic features of FlexChart in Razor Pages. It binds the chart to a model and allows you to select the chart type, series stacking, and rotation. The basic features of FlexChart can also be implemented like MVC.
Input
This view shows how to use input controls in a form in Razor Pages. You can also use model binding features at the same time. Unlike MVC, the property for model binding in input controls needs BindProperty attribute.