How to resolve the Script error in MVC(classic) Grid?
How to resolve the “.
’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 forums, Direct-Trac, or feedback portal. We are always happy to assist you!