Binding to Properties

Data binding to properties is slightly different than binding to traditional data sources. In the previous examples, you've been binding a DataGrid or similar server control to a data source that exposes data values in grid-like structures. Properties are different because they typically consist of a single value. You can't bind a DataGrid to a property because the property doesn't contain a traditional row/column structure. However, you can bind a server control, such as a Label control, to a property. The single value of the property can be rendered as the Label.Text property.

This type of data binding requires a slightly different syntax. You don't have to set a DataSource property. Rather, you bind a property of the ...

Get Programming Data-Driven Web Applications with ASP.NET now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.