

|
<SfGrid TValue="Order" ID="Grid" AllowSorting="true" AllowFiltering="true" AllowPaging="true" AllowTextWrap="true"
Toolbar="@(new List<string>() { "Add", "Delete", "Update", "Cancel" })">
<SfDataManager AdaptorInstance="@typeof(CustomAdaptor)" Adaptor="Adaptors.CustomAdaptor"></SfDataManager>
<GridEditSettings AllowAdding="true" AllowDeleting="true" AllowEditing="true" ShowDeleteConfirmDialog="true" AllowEditOnDblClick="false"></GridEditSettings>
<GridPageSettings PageSize="8"></GridPageSettings>
<GridColumns>
<GridColumn HeaderText="Manage Records" Width="140">
. . .
</GridColumn>
<GridColumn Field=@nameof(Order.OrderID) HeaderText="Order ID" IsPrimaryKey="true" TextAlign="@TextAlign.Center" Width="140"></GridColumn>
<GridColumn Field="ChildOrder.ChildText" AllowEditing="false" AllowAdding="false" DefaultValue="@("default")" HeaderText="Child text" Width="150"></GridColumn>
</GridColumns>
</SfGrid>
@code{
public static List<Order> Orders { get; set; }
. . .
public class ChildOrder
{
[Required]
public string ChildText { get; set; }
}
public class Order
{
[Required]
public int OrderID { get; set; }
public string CustomerID { get; set; }
public double Freight { get; set; }
public ChildOrder ChildOrder { get; set; }
}
// Implementing custom adaptor by extending the DataAdaptor class
public class CustomAdaptor : DataAdaptor
{
// Performs data Read operation
. . .
}
} |