In a Razor Page, `[BindProperty]` tells the model binder to populate a property from request data. It lets a handler use an existing page-model property instead of declaring a duplicate parameter. For a complex property such as `Product`, its member values can be bound from form fields. section 28.4.1
The details that usually matter are:
- The binder looks for values using the property name. An input using `asp-for="Product.Name"` can supply a value for a bound `Product` property without a separately specified input name. section 28.4.1
- GET requests are not bound by default. Set `SupportsGet = true` when the property must receive a value from a GET request. section 28.4.1 section 9.3.7
- Use the `Name` argument when the request-data prefix differs from the property name, including when binding a nested complex value. section 28.4.2
- Use `[BindProperties]` on a class to bind all its public properties, and `[BindNever]` on properties that should be excluded. section 28.4.1
Listing 9.22 The contents of the Completed.cshtml file in the SportsStore/Pages folder
@page
<div class="text-center">
<h2>Thanks!</h2>
<p>Thanks for placing order #@OrderId</p>
<p>We'll ship your goods as soon as possible.</p>
<a class="btn btn-primary" asp-controller="Home">Return to Store</a>
</div>
@functions {
[BindProperty(SupportsGet = true)]
public string? OrderId { get; set; }
}
The completed-order Razor Page puts `[BindProperty(SupportsGet = true)]` on `OrderId` and displays that value in its thank-you message. The small page needs no separate page-model class. section 9.3.7
Binding several form values
A `/pages/bindings` Razor Page gives three inputs the name `Data` and decorates its `Data` array property with `[BindProperty]`, using `Name` to identify the values. Submitting the form populates an array that the page displays. Names such as `Data[1]` and `Data[0]` can specify positions instead; empty fields can produce null values. section 28.5.1

