Articles in this section
Category / Section

How to resolve the Script error in MVC(classic) Grid?

1 min read

How to resolve theTypeError: n is undefined” Script error in Hierarchy Grid.

TypeError: n is undefined’ Script error is raised when hierarchy Grid is created without the Primary key column to the Parent Grid.

Add a specific column to the parent grid containing the child key to resolve this error.

CSHTML:

@(Html.Syncfusion().Grid<GridParent>("GridSrc")
               .Caption("Parent Grid")
               .Datasource(Model)
               .Column(column =>
               {
                   column.Add(p => p.UniversityCode); // Primary Key Column must be add in the parentGrid.
                   column.Add(p => p.Title);
                   column.Add(p => p.Duration);
                   column.Add(p => p.CGPA);
               })
              .EnableSorting()
              .EnablePaging()
              .ChildGrid(child =>
              {
                  child.ChildGridTemplate(Html.Syncfusion().Grid<Child>("ChildGrid_${UniversityCode}")
                  .Caption("Child Grid")
                  .EnableSorting()
                  .Column(col =>
                  {
                      col.Add(c => c.UniversityCode).Width(90);
                      col.Add(c => c.id);
                      col.Add(c => c.Date);
                  })
                    .Mappers(map =>
                    {
                        map.Action("ChildGrid", new { UniversityCode = "${UniversityCode}" });
                    })
                  .ToChildGridTemplate()); }))
 

 

Conclusion

I hope you enjoyed learning how to resolve the Script error in MVC(classic) Grid.

You can refer to ASP.NET MVC Grid feature tour page to know about its other groundbreaking feature representations and documentation, and how to quickly get started for configuration specifications. You can also explore our ASP.NET MVC Grid example to understand how to create and manipulate data.

For current customers, you can check out our components from the License and Downloads page. If you are new to Syncfusion, you can try our 30-day free trial to check out our other controls.

If you have any queries or require clarifications, please let us know in the comments section below. You can also contact us through our support forumsDirect-Trac, or feedback portal. We are always happy to assist you!

Did you find this information helpful?
Yes
No
Help us improve this page
Please provide feedback or comments
Comments (0)
Please sign in to leave a comment
Access denied
Access denied