Back to Devexpress

VirtualServerModeSource.RowType Property

corelibraries-devexpress-dot-data-dot-virtualservermodesource-6db7c180.md

latest3.6 KB
Original Source

VirtualServerModeSource.RowType Property

Gets or sets the type of object whose public properties identify data-aware control columns.

Namespace : DevExpress.Data

Assembly : DevExpress.Data.v25.2.dll

NuGet Package : DevExpress.Data

Declaration

csharp
[DefaultValue(null)]
public Type RowType { get; set; }
vb
<DefaultValue(Nothing)>
Public Property RowType As Type

Property Value

TypeDefaultDescription
Typenull

The row object’s type.

|

Remarks

Specify the RowType property at design time to populate the bound grid control with columns. For example, the sample Data class contains multiple child classes, one of them is Order.

csharp
public class Data
{
    public class Order
    {
        public Order(int _id, DateTime _orderDate, string _name, int _count)
        {
            ID = _id;
            OrderDate = _orderDate;
            ProductName = _name;
            OrderCount = _count;
        }
        public int ID { get; set;}
        public DateTime OrderDate { get; set; }
        public string ProductName { get; set; }
        public int OrderCount { get; set; }
    }
}
vb
Public Class Data
    Public Class Order
        Public Sub New(
          ByVal _id As Integer,
          ByVal _orderDate As Date,
          ByVal _name As String,
          ByVal _count As Integer)
            ID = _id
            OrderDate = _orderDate
            ProductName = _name
            OrderCount = _count
        End Sub
        Public Property ID() As Integer
        Public Property OrderDate() As Date
        Public Property ProductName() As String
        Public Property OrderCount() As Integer
    End Class
End Class

If you want a data-aware control to display Order entities, set the RowType property to the related type.

csharp
virtualServerModeSource1.RowType = typeof(virtDS.Data.Order);
vb
virtualServerModeSource1.RowType = GetType(virtDS.Data.Order)

When you set this VirtualServerModeSource component as a data source for a Data Grid, the Grid generates columns for all data fields found in the class referenced by the RowType property.

At runime, the control fires the AcquireInnerList event if the RowType property is not set. Handle this event to manually supply a list that will store rows fetched by VirtualServerModeSource’s events. If neither the AcquireInnerList event is handled nor the RowType property is set, the source is unable to retrieve column information and a data-aware control bound to this source is empty.

See Also

AutoPopulateColumns

VirtualServerModeSource Class

VirtualServerModeSource Members

DevExpress.Data Namespace