This question is locked. New answers and comments are not allowed.
When I try and call .dataBind() on a grid object in javascript, it throws an exception. The same code I'm using was working just fine with a previous version of the Telerik controls (2010.2.930) but since the update (using NuGet) to the latest version (2011.2.712), the code has broken.
These are the various errors on different browsers.
Firefox 6: this.dataSource is undefined (telerik.grid.min.js - line 1)
Chrome 13: Uncaught TypeError: Cannot call method 'success' of undefined (telerik.grid.min.js:1)
IE 9: SCRIPT5007: Unable to get value of the property 'success': object is null or undefined (telerik.grid.min.js, line 1 character 25697)
I have managed to create a very simple repo, all you need to do is put this in a fresh page:
The GridData class is just a simple POCO with Name and Description string properties.
Any help would be appreciated.
I think my error could be related to the same issue in this thread:
http://www.telerik.com/community/forums/aspnet-mvc/grid/bind-grid-on-client-side-using-json.aspx
These are the various errors on different browsers.
Firefox 6: this.dataSource is undefined (telerik.grid.min.js - line 1)
Chrome 13: Uncaught TypeError: Cannot call method 'success' of undefined (telerik.grid.min.js:1)
IE 9: SCRIPT5007: Unable to get value of the property 'success': object is null or undefined (telerik.grid.min.js, line 1 character 25697)
I have managed to create a very simple repo, all you need to do is put this in a fresh page:
<div> @(Html.Telerik().Grid(new List<GridData>()) .Name("TestGrid") .Columns(column => { column.Bound(e => e.Name).Title("Name").Width("9em"); column.Bound(e => e.Description).Title("Description").Width("9em"); }))</div><p> <a id="getData" href="#">Bind Data</a></p><script type="text/javascript"> (function ($) { $(document).ready(function () { $('#getData').click(bindGridData); }); })(jQuery); var bindGridData = function() { var grid = $("#TestGrid").data("tGrid"); var testData = [ { Name: "Name 1", Description: "Description 1" }, { Name: "Name 2", Description: "Description 2" } ]; grid.dataBind(testData); };</script>The GridData class is just a simple POCO with Name and Description string properties.
Any help would be appreciated.
I think my error could be related to the same issue in this thread:
http://www.telerik.com/community/forums/aspnet-mvc/grid/bind-grid-on-client-side-using-json.aspx