We bind Kendo Grid column dynamically from DB in .net MVC.While we bind that column in Kendo Grid it will give me an error in Browser Console like
"Uncaught SyntaxError: Unexpected identifier".
I have also attached screen shot for console Error and my Code to bind Kendo Grid.
10 Answers, 1 is accepted
Hi,
Thank you for writing to us.
I've gone through the provided snapshots and it seems that the issue is most probably related to one of the following:
1. Format()
2. FooterTemplate or any other template
3. Other javascript error.
So my suggestion as the next step would be to remove or comment out all grid columns temporarily and run the web page again to verify that the problem is related to the column definitions.
Also run the web site on Chrome and always keep the F12 inspector console opened.
Fee free to give this a try and let me know about the result.
Regards,
Eyup
Progress Telerik
Virtual Classroom, the free self-paced technical training that gets you up to speed with Telerik and Kendo UI products quickly just got a fresh new look + new and improved content including a brand new Blazor course! Check it out at https://learn.telerik.com/.

As per you suggestion i did try to comment the column code and run in the chrome then also give it same error in console
I think this is due to DataTable binding with the Grid.
So can you please suggest anything which we adding into it and resolve the Console error
Thanks.
Hi Cygnet,
I am sending a working MVC sample with dynamic columns. It is located in:
Views/Grid/ComboInHeader.cshtml
Feel free to run the page and verify that it is working as expected and there are no errors in the console. Then, you can simulate your own grid to replicate the issue you are having and send the modified version back to us. This will allow us to reproduce the problem locally and provide more accurate and precise suggestions to resolve it.
Regards,
Eyup
Progress Telerik
Virtual Classroom, the free self-paced technical training that gets you up to speed with Telerik and Kendo UI products quickly just got a fresh new look + new and improved content including a brand new Blazor course! Check it out at https://learn.telerik.com/.

Hi
I am sending you full source with the created view has name "ColumnBind.cshtml" and controller method in "EditingController.cs" has Fix value.
You can run this view and it has same error in console which we are facing.
Thanks

Hi
There is some error while attaching full source
I attached here files and mention the folder name.Please put those file in the folder and just run you can find same error
Please put "ColumnBind.cshtml" in the Views\Grid folder
Replace EditingController.cs, ProductViewModel.cs file
Thanks
Hi,
Thank you for the provided code files.
I am now able to reproduce the issue and will check which column exactly causes the problem.
Thank you for your patience in advance. I will get back to you with my findings next week.
Regards,
Eyup
Progress Telerik
Virtual Classroom, the free self-paced technical training that gets you up to speed with Telerik and Kendo UI products quickly just got a fresh new look + new and improved content including a brand new Blazor course! Check it out at https://learn.telerik.com/.
Hello,
I went through the provided sample thoroughly and here is what I found out:
You need also to declare the .Read() action of the grid's datasource in order to complete the binding:
.Read(read => read.Action("Read", "Home"))
public ActionResult Read([DataSourceRequest] DataSourceRequest request)
{
DataTable products = Products();
if (request.Aggregates.Any())
{
request.Aggregates.Each(agg =>
{
agg.Aggregates.Each(a =>
{
a.MemberType = products.Columns[agg.Member].DataType;
});
});
}
return Json(products.ToDataSourceResult(request));
}
https://docs.telerik.com/aspnet-mvc/html-helpers/data-management/grid/how-to/Binding/grid-bind-to-datatable
And this is the full sample:
https://github.com/telerik/ui-for-aspnet-mvc-examples/tree/master/grid/binding-to-datatable
And here is another (older) one:
https://www.telerik.com/support/code-library/binding-to-datatable-0191a594e359
I hope the provided working projects and references will prove a nice stepping stone and help you achieve the full implementation.
Regards,
Eyup
Progress Telerik
Virtual Classroom, the free self-paced technical training that gets you up to speed with Telerik and Kendo UI products quickly just got a fresh new look + new and improved content including a brand new Blazor course! Check it out at https://learn.telerik.com/.

Hello
Can you please refer my code which i already added in the controller and view because this solution is not worked for me.In my case it has more than one list and from that List i need to bind individual column in datatable.
Can you please just verify this code and suggest me solution which i attach below.

Hello,
Can you send me the full sample in an isolated runnable format without any dependencies?
Regards,
Eyup
Progress Telerik
Virtual Classroom, the free self-paced technical training that gets you up to speed with Telerik and Kendo UI products quickly just got a fresh new look + new and improved content including a brand new Blazor course! Check it out at https://learn.telerik.com/.