MVC5 -Grid not showing

Version  syncfusion.ej2.mvc5 19.1.0.54

This doesn't work for me - it shows nothing and no errors are triggered or shown

@{
        DataTable dt = new DataTable("table1");
        dt.Columns.AddRange(new DataColumn[1] { new DataColumn("Col1"typeof(string)) });
        dt.Rows.Add("row1");
        dt.Rows.Add("row2");
 
        Html.EJS().Grid("sfgrid").DataSource(dt).Columns(col=> {col.Field("Col1").HeaderText("col1h").TextAlign(Syncfusion.EJ2.Grids.TextAlign.Center).Width("200").Add(); }).AllowPaging().Render();
    }
The above replaced the following from SyncfusionMvApplication1 - this worked so I don't have an install or license issue

The details on the following I don't believe are relevant it is only post to indicate that I started with a working scenario 
@Html.EJS().Grid("FlatGrid").DataSource((IEnumerable<object>)ViewBag.dataSource).AllowSorting().AllowFiltering().AllowGrouping().AllowResizing(true).Columns(col =>
   {
       col.Field("OrderID").HeaderText("Order ID").IsPrimaryKey(true).MinWidth("120").Width("200").MaxWidth("300").TextAlign(Syncfusion.EJ2.Grids.TextAlign.Right).Add();
       col.Field("CustomerID").HeaderText("Customer Name").Width("150").MinWidth("8").Add();
       col.Field("OrderDate").HeaderText("Order Date").Width("200").EditType("datepickeredit").MinWidth("8").Format("yMd").TextAlign(Syncfusion.EJ2.Grids.TextAlign.Right).Add();
       col.Field("Freight").HeaderText("Freight").Width("150").MinWidth("8").Format("C2").TextAlign(Syncfusion.EJ2.Grids.TextAlign.Right).Add();
       col.Field("ShipCountry").HeaderText("Ship Country").EditType("dropdownedit").MinWidth("8").Width("300").Add();
       col.Field("ShippedDate").HeaderText("Shipped Date").Width("200").Format("yMd").TextAlign(Syncfusion.EJ2.Grids.TextAlign.Right).Add();
       col.Field("ShipName").HeaderText("Ship Name").EditType("dropdownedit").MinWidth("8").Width("200").Add();
       col.Field("Verified").HeaderText("Verified").EditType("booleanedit").DisplayAsCheckBox(true).Type("boolean").MinWidth("8").Width("200").Add();
   }).SelectionSettings(select => select.Type(Syncfusion.EJ2.Grids.SelectionType.Multiple)).AllowPaging().PageSettings(page => page.PageCount(2)).GroupSettings(group => group.Columns(new string[] { "CustomerID" })).Aggregates(agg =>
{
    agg.Columns(new List<Syncfusion.EJ2.Grids.GridAggregateColumn>() { new Syncfusion.EJ2.Grids.GridAggregateColumn() { Field = "Freight", Type = "Sum", GroupFooterTemplate = "Total units: ${Sum}" }, new Syncfusion.EJ2.Grids.GridAggregateColumn() { Field = "Verified", Type = "Truecount", GroupFooterTemplate = "Verified: ${Truecount}" }, new Syncfusion.EJ2.Grids.GridAggregateColumn() { Field = "Freight", Type = "Max", GroupCaptionTemplate = "Maximum: ${Max}" } }).Add();
}).EditSettings(edit => { edit.AllowAdding(true).AllowEditing(true).AllowDeleting(true).Mode(Syncfusion.EJ2.Grids.EditMode.Normal); }).Toolbar(new List<string>() { "Add", "Edit", "Delete", "Update", "Cancel" }).SortSettings(sort => sort.Columns(cols)).FilterSettings(filter => { filter.Type(Syncfusion.EJ2.Grids.FilterType.Menu); }).Render()
Thanks in advance - I am assuming this is so simple that I am just blind

1 Reply 1 reply marked as answer

RS Rajapandiyan Settu Syncfusion Team April 14, 2021 10:02 AM UTC

Hi David, 
 
Thanks for contacting Syncfusion support. 
 
Please refer to the below documentation to get start with the ASP.NET MVC Grid control. 
 
 
 
Still, if you face the same issue please share the below details to replicate this at our end. 
 
  1. Explain the issue you have faced in detail? Is the grid not rendered at initial load?
  2. Did you faced any console error while rendering the Grid. Share the error details if any.
  3. Bind the actionFailure event in Grid to catch the Exceptions and share the screenshot of the error details in that actionFailure event.
  1. Share the script version.
  2. Did you faced any license issue on using Syncfusion component? Share the details.
 
Regards, 
Rajapandiyan S 


Marked as answer
Loader.
Up arrow icon