Partager via


DisplayAttribute.Order Property

Microsoft Silverlight will reach end of support after October 2021. Learn more.

Gets or sets a value that indicates the order in which columns are sorted.

Namespace:  System.ComponentModel.DataAnnotations
Assembly:  System.ComponentModel.DataAnnotations (in System.ComponentModel.DataAnnotations.dll)

Syntax

'Declaration
Public Property Order As Integer
public int Order { get; set; }

Property Value

Type: System.Int32
A value that indicates the order in which columns are sorted.

Exceptions

Exception Condition
InvalidOperationException

The get accessor is called when the Order property has not been set.

Remarks

Columns are sorted in increasing order based on the Order property. Negative values are allowed and can be used to place a column before all other columns. If this property is not set, the presentation layer will determine the order to display the column.

Use the GetOrder method to retrieve the value of the Order property. The GetOrder method returns nulla null reference (Nothing in Visual Basic) if the Order property has not been set, but the get accessor of the Order property throws an InvalidOperationException if the value is not set.

Version Information

Silverlight

Supported in: 5, 4, 3

Platforms

For a list of the operating systems and browsers that are supported by Silverlight, see Supported Operating Systems and Browsers.