<TelerikGrid Data="@GetRows()" TItem="DataRow" PageSize="5">
<GridColumns>
@foreach (DataColumn column in dataTable.Columns)
{
<GridColumn Field="@column.ColumnName" Title="@column.ColumnName" />
}
</GridColumns>
</TelerikGrid>
@code {
private DataTable dataTable;
protected override void OnInitialized()
{
dataTable = new DataTable("MyDataTable");
dataTable.Columns.Add("ID", typeof(int));
dataTable.Columns.Add("Name", typeof(string));
dataTable.Rows.Add(1, "John");
dataTable.Rows.Add(2, "Jane");
}
private IEnumerable<DataRow> GetRows()
{
return dataTable.Rows.Cast<DataRow>();
}
}
this code not working .Is there any other ways?
If the data is binding but not displaying correctly, try explicitly setting the Template property of your GridColumn elements to customize the rendering of each cell.