DetailsView Caption & CaptionAlign

This sample demonstrates the Caption and CaptionAlign properties which render a <caption> element on the underlying table.


Caption (Default Alignment)

Product Record
Id 1
Name Widget
Price 9.99
Category Tools
InStock True

CaptionAlign Variations

The CaptionAlign property positions the caption relative to the table. Values: Top (default), Bottom, Left, Right.

Top

Top Caption
Id 1
Name Widget
Price 9.99
Category Tools
InStock True

Bottom

Bottom Caption
Id 1
Name Widget
Price 9.99
Category Tools
InStock True

Code Example

<DetailsView ItemType="Product"
             Items="@_products"
             AutoGenerateRows="true"
             Caption="Product Record"
             CaptionAlign="TableCaptionAlign.Top"
             GridLines="GridLines.Both" />