DisplayColumnAttribute Constructors
Definition
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
Initializes a new instance of the DisplayColumnAttribute class.
Overloads
DisplayColumnAttribute(String) |
Initializes a new instance of the DisplayColumnAttribute class by using the specified column. |
DisplayColumnAttribute(String, String) |
Initializes a new instance of the DisplayColumnAttribute class by using the specified display and sort columns. |
DisplayColumnAttribute(String, String, Boolean) |
Initializes a new instance of the DisplayColumnAttribute class by using the specified display column, and the specified sort column and sort order. |
DisplayColumnAttribute(String)
- Source:
- DisplayColumnAttribute.cs
- Source:
- DisplayColumnAttribute.cs
- Source:
- DisplayColumnAttribute.cs
Initializes a new instance of the DisplayColumnAttribute class by using the specified column.
public:
DisplayColumnAttribute(System::String ^ displayColumn);
public DisplayColumnAttribute (string displayColumn);
new System.ComponentModel.DataAnnotations.DisplayColumnAttribute : string -> System.ComponentModel.DataAnnotations.DisplayColumnAttribute
Public Sub New (displayColumn As String)
Parameters
- displayColumn
- String
The name of the column to use as the display column.
Examples
The following example shows how to define the parent column to display in a page for the child table as the foreign-key column.
[DisplayColumn("LastName")]
public partial class Customer
{
}
<DisplayColumn("LastName")> _
Public Partial Class Customer
End Class
Applies to
DisplayColumnAttribute(String, String)
- Source:
- DisplayColumnAttribute.cs
- Source:
- DisplayColumnAttribute.cs
- Source:
- DisplayColumnAttribute.cs
Initializes a new instance of the DisplayColumnAttribute class by using the specified display and sort columns.
public:
DisplayColumnAttribute(System::String ^ displayColumn, System::String ^ sortColumn);
public DisplayColumnAttribute (string displayColumn, string sortColumn);
public DisplayColumnAttribute (string displayColumn, string? sortColumn);
new System.ComponentModel.DataAnnotations.DisplayColumnAttribute : string * string -> System.ComponentModel.DataAnnotations.DisplayColumnAttribute
Public Sub New (displayColumn As String, sortColumn As String)
Parameters
- displayColumn
- String
The name of the column to use as the display column.
- sortColumn
- String
The name of the column to use for sorting.
Remarks
By default, the column specified in sortColumn
will be sorted in ascending order.
Applies to
DisplayColumnAttribute(String, String, Boolean)
- Source:
- DisplayColumnAttribute.cs
- Source:
- DisplayColumnAttribute.cs
- Source:
- DisplayColumnAttribute.cs
Initializes a new instance of the DisplayColumnAttribute class by using the specified display column, and the specified sort column and sort order.
public:
DisplayColumnAttribute(System::String ^ displayColumn, System::String ^ sortColumn, bool sortDescending);
public DisplayColumnAttribute (string displayColumn, string sortColumn, bool sortDescending);
public DisplayColumnAttribute (string displayColumn, string? sortColumn, bool sortDescending);
new System.ComponentModel.DataAnnotations.DisplayColumnAttribute : string * string * bool -> System.ComponentModel.DataAnnotations.DisplayColumnAttribute
Public Sub New (displayColumn As String, sortColumn As String, sortDescending As Boolean)
Parameters
- displayColumn
- String
The name of the column to use as the display column.
- sortColumn
- String
The name of the column to use for sorting.
- sortDescending
- Boolean
true
to sort in descending order; otherwise, false
. The default is false
.
Examples
The following example shows how to define the parent column to display in a page for the child table as the foreign-key column. It sets the parent table column for sorting and also sets the sort order.
[DisplayColumn("City", "PostalCode", false)]
public partial class Address
{
}
<DisplayColumn("City", "PostalCode", False)> _
Partial Public Class Address
End Class