Archive For November 2020
Implementing a Custom TypeConverter In Razor Pages
calendar_today 24 November 2020 18:34
In my most recent article, I showed
how to create a custom model
binder to bind an ISO 8601 string representation of a week of the year
to a DateTime
type in a Razor Pages application. The custom
model binder leant heavily on the existing infrastructure that binds
strings to simple types. Custom model binders are the correct solution
if you want to bind to simple types, but if you want to bind to a
complex type, the recommendation is to implement a TypeConverter
according to the offical docs. But the docs don't provide an example
that shows how to do that in the context of model binding. So here's
one.
Implementing a Custom Model Binder In Razor Pages
calendar_today 10 November 2020 15:28
In Razor Pages, model binding is the process that maps data from an HTTP request to simple PageModel properties or handler parameters. Incoming data can be included in a request as posted form values, query string values or route data. The default collection of model binders cover every simple .NET data type.. But sometimes they are not enough, and you need to add your own implementation.
Working with Dates And Times in Razor Pages Forms
calendar_today 02 November 2020 17:17
When working with dates and times in a Razor Pages form, you need to render a suitable control based in the task requirement. Prior to HTML5, developers largely depended on third party date picker libraries. Now, a variety of native browser options exist, although they enjoy varied support across modern browsers. These include options for managing the date and time, just the date or time, and for working with the month or week of the year.