<EjsGrid id="Grid" DataSource="@gridData" AllowPaging="true">
<GridPageSettings PageSize="5"></GridPageSettings>
<GridSelectionSettings PersistSelection="true"></GridSelectionSettings>
<GridColumns>
<GridColumn Field=@nameof(OrdersDetails.OrderID) HeaderText="Order ID" IsPrimaryKey="true" TextAlign="@TextAlign.Right" Width="120"></GridColumn>
<GridColumn Field=@nameof(OrdersDetails.CustomerID) HeaderText="Customer Name" Width="150"></GridColumn>
. . . .
</GridColumns>
</EjsGrid>
@functions {
public object gridData { get; set; }
protected override void OnInit()
{
gridData = OrdersDetails.GetAllRecords();
}
} |
<EjsGrid id="Grid" DataSource="@gridData" AllowPaging="true" RowSelected="@rowselect">
<GridPageSettings PageSize="5"></GridPageSettings>
<GridSelectionSettings PersistSelection="true"></GridSelectionSettings>
<GridColumns>
<GridColumn Field=@nameof(OrdersDetails.OrderID) HeaderText="Order ID" IsPrimaryKey="true" TextAlign="@TextAlign.Right" Width="120"></GridColumn>
. . . .
</GridColumns>
</EjsGrid>
@functions {
public object gridData { get; set; }
protected override void OnInit()
{
gridData = OrdersDetails.GetAllRecords();
}
public void rowselect(RowSelectEventArgs args)
{
System.Console.WriteLine(args.RowIndex);
}
}
|