Using JSON as a data source

JSON can also be used as a data source either as a file or as an API url. The sample also uses the Cache property to cache the JSON data in memory to improve performance

Loading...
Razor code

    var gridModel = new GridModel(DataSourceType.JSON, "/data/ProductHunt.json");
gridModel.Columns = new List()
{
    new GridColumn("Name") {},
    new GridColumn("TagLine"),
    new GridColumn("Link") {Format = FormatType.Url},
    new GridColumn("ImgLink", "Image") {Format = FormatType.Image, RegularExpression = @"^.*?(?=,)"},
    new GridColumn("Industry"),
    new GridColumn("Votes", "Votes") {DataType = typeof(Int32)},
    new GridColumn("PaymentStatus", "Status")
};
gridModel.Cache = true;

@(await new DbNetSuiteCore.GridControl(HttpContext).Render(gridModel))